Thursday, May 16, 2013

How to Configure Passwordless SSH


Information about Configuring ssh Login Without Password 
This document will describe how to configure ssh login from one one host to another host without requiring a password. This is only used for accounts we setup that utilize scripts that require ssh from host a / User A to host b / User B. 
 
Document Creator 
Todd Walters 
 
Requirements 
 
  • ssh  must be installed and enabled. 
  • accounts on server a/b 
How to Configure ssh Without Password 
  1. Login to server A as user A and generate pair of ssh keys (don't use passphrase)  
    • [ddevadm2@server1 ~]$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/export/home/ddevadm2/.ssh/id_rsa): Created directory '/export/home/ddevadm2/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /export/home/ddevadm2/.ssh/id_rsa. Your public key has been saved in /export/home/ddevadm2/.ssh/id_rsa.pub. The key fingerprint is: 47:61:9c:79:79:3a:a2:56:48:64:49:f5:44:25:19:bc ddevadm2@srv0asxd11 
  2. Create .ssh directoy on Server B in User B's home directory  
  3. Add User A's public to User B on Server B's in .ssh/authorized_keys  
    • [ddevadm2@server1 ~]$ cat .ssh/id_rsa.pub | ssh tsanadm2@srv0asxt11 'cat >> .ssh/authorized_keys' 
  4. Login to Server B and change authorized_keys permissions.  
    • [ddevadm2@server1 ~]$ ssh tsanadm2@server2 
    • [tsanadm2@server2 .ssh]$ ls -l authorized_keys -rw-rw-r--  1 tsanadm2 tsanadm2 230 Sep 22 11:59 authorized_keys [tsanadm2@server2 .ssh]$ chmod 700 authorized_keys [tsanadm2@server2 .ssh]$ ls -l authorized_keys -rwx------  1 tsanadm2 tsanadm2 230 Sep 22 11:59 authorized_keys 
  5. Test login from server a/user a to server b/user b and you should not require password.

No comments:

Post a Comment