26

I'm using Linode, and I've asked around on the IRC channels, but no one seems to know. I've logged into my server via LISH (reference), and I used the correct password, and everything went fine. However, I need to login via SSH/FTP, and I can't. It keeps on giving me "permission denied". I know the password is correct because I reset it via LISH, and I know I've got the login method right because I've logged into my server before using the exact same commands. I sure hope this doesn't turn out to be some noob issue, or I'm going to be quite frustrated.

49

You need to run ssh (the client, and possibly the server) with more verbosity to understand why authentication is failing. For the client, run

ssh -vvv username@host 

On the server end, check the logs. /var/log/auth.log will give you a pretty good idea about what happens when you try to login, look for messages that contain sshd. There are a variety of reasons why authentication could be failing, ranging from simple (you aren't using the right username) to more complicated (sshd is configured to use the wrong authentication system).

8
  • Thanks, I'll check that out as soon as I can get back to working on the server.
    – willbeeler
    Mar 6 '12 at 19:32
  • I reset my password via the Web Console in Linode, and I was able to get back in. I appreciate the verbose tip. That's very useful.
    – willbeeler
    Mar 9 '12 at 15:26
  • thank you, turns out my server also have ssh ip restriction i found out by looking to auth.log.
    – siniradam
    Nov 23 '15 at 10:18
  • 1
    Running ssh -d -d -d on the server side I see "Failed password for michael" ... "invalid password for user michael" But it's the right user and password!
    – Michael
    Aug 28 '17 at 23:23
  • I had the same problem. Two clean installs failed to connect. I noted that a password that contained a @ character always failed. When I used a ! character instead it worked. This might be nonsense but maybe it will help someone Nov 8 '17 at 0:02
1

in my case our IT department had setup PAM stuff with rules that broke my login. followed @pestilence 's reply to see error, ended up commenting out AllowGroups in /etc/ssh/sshd_config, which was setup to some IT stuff:

UsePAM yes
#AllowGroups <some IT groups>

1

I had the same incident, I tried all solutions above and they didn't help, the final cause was because i tried to change my shell to fish using chsh.

I had console access to the machine, so i made tail -f /var/log/auth.log, so i found the error message user is invalid because shell /bin/fish is not found.

I was also unable to run chsh again because of the same login issue, so i made a symlink from /bin/fish to /bin/sh, and i was able to log in immediately.

1
  • 1
    Just created an account to upvote this. I changed to fish shell and Windows 10 Terminal was failing to ssh with receive packet: type 51 using the correct password. Changing my shell at /etc/passwd from fish back to bash resolved it.
    – Tyathalae
    Dec 27 '21 at 1:15
0

Try using a different port. Seems that the SSH port the server was using was being used by another service, and I was getting some verrrrry wonky results.

0

In my case I edited /etc/shadow- with a text editor, as file manager was the only access I had. Even after I put the original hash string back somehow it didnt work. So after I reset a password with hosting panel all became working.

Not the answer you're looking for? Browse other questions tagged or ask your own question.