Linux – SSH without password

linuxssh

I'm unable to ssh without a password for some reason on a new CentOS box.

I've tried following these guides:

But neither are working. I even checked my /etc/ssh/sshd_config file. PubkeyAuthentication yes was originally commented out so I uncommented that line and restarted sshd but still to no avail. Any thoughts of anything else that could be missing?

I'm trying to ssh from server A to server B as root. Thus, logged in as root on one box, then ssh to the next as root without being prompted for a password.

UPDATE

I ran a ssh -v ... but cannot copy/paste into here. Everything looked good until this line:

debug1: Next authentication method:  gssapi-with-mic
debug1: Unspecified GSS failure.  Minor Code may provide more information
Unknown code krb5 195

Best Answer

A small how-to for public key based authentication for CentOS/Red Hat/etc...

On the SSH client:

ssh-keygen # Accept all defaults, do not enter a password.
ssh-copy-id USER@SERVER_IP
restorecon -R ~/.ssh

On the SSH server:

# Login to the server normally (with password)
restorecon -R ~/.ssh

Public key based authentication should now work.