Wednesday 23 July 2014

SSH Passwordless or RSA key authentication

Log to a remote system using SSH without having to type the password.
This has few different names, such as: passwordless, RSA key authentication, key based auth etc.

Recently i was trying to implement a mechanism to save all logs under /var/log/ to a central server, just for keeping a record daily of these logs, in case we need to check things out at later date (security).

You will need to make some changes to the remote SSH server and the local SSH client.
To start with lets name two Linux Servers: Linux01 and Linux02.

You want to lot to Linux02 from Linux01 without having to type the password for a specific user, let's call it "user01".

Make sure the user exists on both Linux servers or at least on the remote Server (Linux02).
# adduser user01
# passwd user01

# su - user01
~ ssh-keygen

cat .ssh/id_rsa.pub | ssh user01@linux02 'cat >> .ssh/authorized_keys'

chmod 600 authorized_keys

by Renato de Oliveira

No comments:

Post a Comment