SSH Login without password

Rahul and I have a root access to remote server.

  1. 1. #yum  -y install openssh
  2. 2. Ssh Rahul@localhost     # to get full environment of user Rahul
  3. 3. [Rahul@intranet ~]$ssh-keygen  -t rsa  # -t option allow you to select type of algorithm like #RSA or DSA
  4. 4. Now make sure on remote Linux/UNIX server .ssh directory exists in user’s home directory. In my environment it is /root/.ssh/. User roots home directory.
  5. 5. [Rahul@intranet ~]$ ssh root@”remote server” mkdir –p ~root/.ssh
  6. 6. [Rahul@intranet ~]$scp -p /home/Rahul/.ssh/ root@”remote server” /root/.ssh/authorized_keys #it will ask you for RSA fingerprint and prompt for a password.

If you already have .ssh/authorized_keys on remote server then don't just override the file but append the content of .ssh/authorized_keys file:

[Rahul@intranet ~]$cat .ssh/ | ssh root@”remote server”  'cat >> .ssh/authorized_keys'

Now check you’re ssh connection it wouldn’t ask you for a password.

[Rahul@intranet ~]$ssh root@”remote server”

Last login: Thu Dec 6 14:23:13 2007 from intranet

[root@”remote server”~]#

If you are using ssh then it's very easy to setup automated logins using ssh on remote servers. In large data center environments running Linux/UNIX servers you may require performing routine task like copying or deleting of some files and folders, openssh is the great tool to reduce your work. Having automated ssh setup has own advantages as it allows running remote commands on remote server securely. This would require generating public key private key pair.

Taxonomy upgrade extras: