I would to know how I can deactivate the login password on my Raspberry Pi? I need to login automatically after entering the following command on terminal:
ssh pi@<IP_address>
i.e., it should not ask for password to login.
It is NOT recommended to disable the SSH password if your device is going to publicly available - for example connected to the internet with SSH port forwarder.
To disable SSH login authentication you need to edit some files:
/etc/ssh/sshd_config
PasswordAuthentication yes - ChallengeResponseAuthentication yes - UsePAM yes
no and have no # in front.Restart SSHD or the Pi
If you get a message
Permission denied (publickey)
then set these in sshd_config to no,
RSAAuthentication yes
PubkeyAuthentication yes
Restart SSHD or the Pi
TIPS
In sshd_config you can add. So it will only ask root for password,
Match User !root
PasswordAuthentication no
And then you add a new user with limited permissions.Always log in as that user and when you need to do something as root you can just use sudo "command" - enter the root password and it will do it and come back to your low privilege user.
To elevate into a root console from low privilege just type sudo enter your password. Once you are done type exit and you will drop back to the low privilege user.
Did I already say that removing root user password and ssh key login is a very bad idea on a device that will be publicly available. Never do this on a public device!
Instead of not using passwords what you need is SSH keys: SSH with authentication key instead of password.
After configuring key authentication you can then remove the password from the local (client) key and ssh pi@rasp will just work. But only from a machine that has the key.
PasswordAuthentication noto disable password login? Is it really required to set alsoChallengeResponseAuthentication noandUsePAM no? – Grzegorz Wierzowiecki Feb 04 '17 at 08:03PasswordAuthenticationtono. If there is a reason, though, it'd be good is someone could update the answer to explain. – Joseph Feb 17 '22 at 17:12