I know this question has been asked one million times - but all the input I found so far didn't help.
Long story short: I cannot SSH into my Raspi anymore.
Yesterday I've installed Raspberry Pi OS x64 as a clean installation from scratch (no upgrade installation). I spent all the day installing and configuring several things, e. g.:
- Docker
- ufw
- fail2ban
- nginx
I cannot count how many times I SSHed yesterday into my Raspi after installation - maybe three dozen times, without any issues.
This morning I wanted to continue my work, but ssh myRaspiUser@myRaspi
gives Permission denied, please try again.
. myRaspi
has sudo
rights.
The same happens for ssh pi@myRaspi
. Both accounts are set up for password
authentication.
There is another user raspiUserWithoutPassword
which uses publickey
authentication - and this one can still connect.
My client is a Windows 10 machine with all the latest updates. In all cases, I'm using the same windows account MyWindowsUser
for connecting with pi
, myRaspiUser
or raspiUserWithoutPassword
.
When connecting the Raspi via HDMI cable to my screen and log in via UI, I can still access all accounts without any issues.
Here are some things I already tried:
ping myRaspi
Pinging myRaspi.fritz.box [192.168.178.20] with 32 bytes of data:
Reply from 192.168.178.21: bytes=32 time=65ms TTL=64
Reply from 192.168.178.21: bytes=32 time=3ms TTL=64
Reply from 192.168.178.21: bytes=32 time=3ms TTL=64
Reply from 192.168.178.21: bytes=32 time=3ms TTL=64
Ping statistics for 192.168.178.21:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 3ms, Maximum = 65ms, Average = 18ms
ssh -v myRaspiUser@myRaspi
OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
debug1: Connecting to myRaspi [192.168.178.21] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\MyWindowsUser/.ssh/id_rsa type 0
debug1: identity file C:\\Users\\MyWindowsUser/.ssh/id_rsa-cert type -1
debug1: identity file C:\\Users\\MyWindowsUser/.ssh/id_dsa type -1
debug1: identity file C:\\Users\\MyWindowsUser/.ssh/id_dsa-cert type -1
debug1: identity file C:\\Users\\MyWindowsUser/.ssh/id_ecdsa type -1
debug1: identity file C:\\Users\\MyWindowsUser/.ssh/id_ecdsa-cert type -1
debug1: identity file C:\\Users\\MyWindowsUser/.ssh/id_ed25519 type -1
debug1: identity file C:\\Users\\MyWindowsUser/.ssh/id_ed25519-cert type -1
debug1: identity file C:\\Users\\MyWindowsUser/.ssh/id_xmss type -1
debug1: identity file C:\\Users\\MyWindowsUser/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.4p1 Debian-5
debug1: match: OpenSSH_8.4p1 Debian-5 pat OpenSSH* compat 0x04000000
debug1: Authenticating to myRaspi:22 as 'myRaspiUser'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:9Q0YBbDhnTvnJ/Jt4IEdTN29L6dFcdfR5iRjl9L8Qqk
debug1: Host 'myRaspi' is known and matches the ECDSA host key.
debug1: Found key in C:\\Users\\MyWindowsUser/.ssh/known_hosts:3
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: Will attempt key: C:\\Users\\MyWindowsUser/.ssh/id_rsa RSA SHA256:mX01zgqbmFoeRnLdwc04tX4ekPg0s/yH6Skh8aT+Mlw
debug1: Will attempt key: C:\\Users\\MyWindowsUser/.ssh/id_dsa
debug1: Will attempt key: C:\\Users\\MyWindowsUser/.ssh/id_ecdsa
debug1: Will attempt key: C:\\Users\\MyWindowsUser/.ssh/id_ed25519
debug1: Will attempt key: C:\\Users\\MyWindowsUser/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,[email protected],ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected]>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: C:\\Users\\MyWindowsUser/.ssh/id_rsa RSA SHA256:mX01zgqbmFoeRnLdwc04tX4ekPg0s/yH6Skh8aT+Mlw
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: C:\\Users\\MyWindowsUser/.ssh/id_dsa
debug1: Trying private key: C:\\Users\\MyWindowsUser/.ssh/id_ecdsa
debug1: Trying private key: C:\\Users\\MyWindowsUser/.ssh/id_ed25519
debug1: Trying private key: C:\\Users\\MyWindowsUser/.ssh/id_xmss
debug1: Next authentication method: password
debug1: read_passphrase: can't open /dev/tty: No such file or directory
myRaspiUser@myRaspi's password:
Permission denied, please try again.
ls -la /dev/tty
crw-rw-rw- 1 root tty 5, 0 Jun 6 12:21 /dev/tty
sudo ufw status
Status: active
To Action From
-- ------ ----
22/tcp ALLOW Anywhere
Nginx Full ALLOW Anywhere
22/tcp (v6) ALLOW Anywhere (v6)
Nginx Full (v6) ALLOW Anywhere (v6)
- Using IP address instead of host name → same errors
- Using
-o StrictHostKeyChecking=no
→ same errors - Calling
ssh [email protected]
when locally logged in asmyRaspiUser
(Raspi is attached via HDMI cable) → same errors - Simplified password (
HelloWorld123
) to avoid any typos → same errors grep PasswordAuthentication /etc/ssh/sshd_config
#PasswordAuthentication yes
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication, then enable this but set PasswordAuthentication
ls -ld /run
(as usermyRaspi
, noroot
/sudo
)
drwr-xr-x 31 root root 920 Jun 6 18:23 /run
ls -ld /var/run
(as usermyRaspi
, noroot
/sudo
)
lrwxrwxrwx 1 root 4 Apr 4 16:25 /var/run -> /run
cat /usr/lib/tmpfiles.d/sshd.conf
(as usermyRaspi
, noroot
/sudo
)
cat: /usr/lib/tmpfiles.d/sshd.conf: No such file or directory
After several attempts, I'm receiving ssh_dispatch_run_fatal: Connection to 192.168.178.21 port 22: Connection timed out
. I assume this is due to fail2ban and I can retry after a couple of minutes.
The question is pretty simple ^^ how can I SSH into my Raspi again using password authentication?
Thanks in advance
grep PasswordAuthentication /etc/ssh/sshd_config
say?#
beforePasswordAuthentication yes
and try again. Restartsshd
after you've edited the file.sshd
; run/usr/sbin/sshd -d
in the foreground ; next try to login from your Windows and see if that produces any usefull information?