SSH "Permission denied, please try again." with the right password
ssh asks for the password again, then fails: the password is wrong for that user, root may not use passwords, or the server refuses the login. Read sshd's log.
You type the password, ssh asks again:
[email protected]'s password:
Permission denied, please try again.
[email protected]'s password:
and after the third try it gives up with something like [email protected]: Permission denied (publickey,password).
ssh prints "Permission denied, please try again." whenever the server rejects a password and it is about to ask again. The server never says why, on purpose. The reason is in the server's log.
Read the server's log
On the host, or ask its administrator:
sudo journalctl -u ssh -u sshd --since "10 min ago"
(The service is called ssh on Debian and Ubuntu, or sshd, depending on the system.)
Match what you find:
| sshd log line | Meaning | |---|---| | Failed password for user1 from ... | The password is wrong for that account. | | Failed password for invalid user user1 from ... | There is no such user on this host. Check the user name, including case. | | ROOT LOGIN REFUSED FROM ... and Failed password for root ... | Root may not log in this way: see below. | | User user1 from ... not allowed because ... | An AllowUsers, DenyUsers, AllowGroups or DenyGroups rule keeps this user out. | | User user1 not allowed because ... | The account is locked, or its shell does not exist or cannot be run. |
Logging in as root with a password
The default for PermitRootLogin in OpenSSH is prohibit-password: root may log in with a key, but password and keyboard-interactive logins for root are turned off.
sshd still asks for root's password and then rejects it, even when it is correct, so the client looks the same as for a typo. Either log in as a normal user and use sudo, or set up a key for root. Whether root may use a password at all is the administrator's decision in sshd_config.
Check the user name
ssh host.example.com logs in with the user name you have on your own computer, unless the command or ~/.ssh/config says otherwise. The prompt shows which name was used: [email protected]'s password:. If that is not your account on the host, give the right one: ssh [email protected].
If you are never asked for a password
If ssh goes straight to Permission denied (publickey). without a prompt, the server does not offer password logins at all (PasswordAuthentication no), and only keys work. The list in brackets is what the server allows. See SSH error messages, what each one means and PuTTY "No supported authentication methods available (server sent: publickey)".
Related
- sshd log "Received disconnect ... 11: Bye Bye" with preauth
- SSH "Too many authentication failures"
- Authorized keys and permissions
- IBM i SSH "Permission denied": home, key permissions, PASE shell