• Antelope Release 5.10 Linux CentOS release 7.6.1810 (Core) 3.10.0 2020-05-12

 

NAME

ssh - How to use SSH with no passwords

DESCRIPTION

On your local machine you should already have an "identity.pub" that was created with ssh-keygen (specifically ssh-keygen1). If not, create one. (Choose a pass phrase that you can remember, but you do not need it if you setup your ssh-logins to run without passwords!)

Copy identity.pub

Change the permissions on ~/.ssh/authorized_keys to 644 (-rw-r--r--)!!! Change the permissions on ~/.ssh to 755 (-rwxr-xr-x)!!! This can cause hours of frustration if you forget to do this... You should now be able to login without a password using ssh. You may have to fuss with /etc/hosts to make sure the IP-hostname is setup properly (especially if you have one IP that has been used for multiple hosts). In your known_hosts file you can have the same key with different host names (i.e. bbarray and bbarray.ucsd.edu) but you need to have both of these names in the /etc/hosts file. When you are ssh-ing to a host for the first time, you receive the following query: Host key not found from the list of known hosts. Are you sure you want to continue connecting (yes/no)? You must type the full word yes to accept... a simple y does not work.

Server Side Debugging

To debug problems on the server side, you can run sshd in debug mode on a different port:

remotehost$ sudo /usr/sbin/sshd -p 10022 -e -ddd

Now from the client, connect using the same port:

client$ ssh -p 10022 -vvv -i keyfile remoteuser@remotehost

SEE ALSO

ssh(1)

BUGS AND CAVEATS

The home directory must have drwxr-xr-x not drwxrwxr-x permissions. In fact, no directory on the path to ~/.ssh may have permissions allowing group or other write access.

AUTHOR

Jennifer Eakins
Printer icon