Announcement

Collapse
No announcement yet.

Setting SSH Key

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Setting SSH Key

    Securing Remote Access and Copy with SSH

    Setting up ssh key to logon to remote machine with the help of ssh key. It is more secure way to remote login. It is useful for remote rsync backup.

    Steps on (server1).
    Login to your (server1) and follow following steps.

    [email protected] server1 [~]# pwd
    /root
    [email protected] [~]# mkdir .ssh
    [email protected] [~]# cd .ssh/
    [email protected] [~/.ssh]# ssh-keygen -t rsa
    It will create key pair. id_rsa (private key) and id_rsa.pub (public key)

    [email protected] server1 [~/.ssh]# ls -l
    total 28
    -rw------- 1 root root 883 Apr 4 2006 id_rsa
    -rw-r--r-- 1 root root 234 Apr 4 2006 id_rsa.pub


    login to the remote server (server2) and copy the contents of id_rsa.pub ( as above) in /root/.ssh/ authorized_keys file.

    Steps on remote server (server2).

    [email protected] server1 [~]# pwd
    /root
    [email protected] [~]# mkdir .ssh
    [email protected] [~]# cd .ssh/
    [email protected] [~/.ssh]# touch authorized_keys
    [email protected] [~/.ssh]# ssh server1.example.com cat /root/.ssh/id_rsa.pub >> authorized_keys

    Now you should not asked for password while sshing from server 1 to server2.
Working...
X