How to Setup SSH Key Authentication Instead of Username/Password

linuxssh

How do you setup ssh to authenticate a user using keys instead of a username / password?

Best Answer

For each user: they should generate (on their local machine) their keypair using ssh-keygen -t rsa (the rsa can be replaced with dsa or rsa1 too, though those options are not recommended). Then they need to put the contents of their public key (id_rsa.pub) into ~/.ssh/authorized_keys on the server being logged into.