Announcement Announcement Module
Collapse
No announcement yet.
SSH Passwordless Login Using SSH Keygen Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SSH Passwordless Login Using SSH Keygen

    Secure Shell (SSH) is a crytographic network protocol for secure data communication,remote command-line login, remote command execution, and other secure network services between two networked computers. it connects, via secure channel over an insecure network, a server and a client running SSH server and SSH client programs, respectively.Below are the steps for SSH password-less automatic login from server on server to other.

    login from 192.168.1.1 as root to 192.3168.1.2 with user xyz

    step 1:

    First login into server 192.168.1.1 with user root and generate a pair of public keys using the keygen command.


    [root@192.168.1.1 ~]$ ssh-keygen -t rsa


    Generating public/private rsa key pair.
    Enter file in which to save the key (root/.ssh/id_rsa):
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /root/.ssh/id_rsa.
    Your public key has been saved in /root/.ssh/id_rsa.pub.
    The key fingerprint is:
    20:40:92:6d:2d:a0:d2:c9:63:83:20:74:88:67:54:f9 root@192.168.1.1
    The key's randomart image is:
    +--[ RSA 2048]----+
    |BB=+.. |
    |**Boo |
    |++B.... |
    |.. o .E. |
    | S |
    | |
    | |
    | |
    | |
    +-----------------+


    step 2:

    Create a .ssh directory on 192.168.1.2

    [root@192.168.1.1 ~]$ ssh xyz@192.168.1.2 mkdir -p .ssh


    step 3:

    Use SSH from server 192.168.1.1 and upload new generated public key (id_rsa.pub) on server 192.168.1.2 under xys ‘s .ssh directory as a file name authorized_keys.

    [root@192.168.1.1 ~]$ cat .ssh/id_rsa.pub | ssh xyz@192.168.1.2 'cat >> .ssh/authorized_keys'

    xyz@192.168.1.2's password: [Enter Your Password ]


    step 4:

    Change permissions on 192.168.1.2. There are different ssh versions on servers so we need to change the permissions on .ssh directory and authorized_keys file.

    [root@192.168.1.1 ~]$ ssh xyz@192.168.1.2 "chmod 700 .ssh; chmod 640 .ssh/authorized_keys"

    step 5:

    Try login without passwords


    [root@192.168.1.1 ~]$ ssh xyz@192.168.1.2



Tag Cloud Tag Cloud Module
Collapse
Working...
X