SSH key Authentication LINUX

 To generate an RSA key pair to work with version 2 of the protocol, type the following command at a shell prompt:

    ssh-keygen -t rsa

    Accept the default file location of ~/.ssh/id_rsa. Enter a passphrase different from your account password and confirm it by entering it again.



    The public key is written to ~/.ssh/id_rsa.pub. The private key is written to ~/.ssh/id_rsa. Never distribute your private key to anyone.
    Change the permissions of the .ssh directory using the following command:

    chmod 755 ~/.ssh

    Copy the contents of ~/.ssh/id_rsa.pub into the file ~/.ssh/authorized_keys on the machine to which you want to connect. If the file ~/.ssh/authorized_keys exist, append the contents of the file ~/.ssh/id_rsa.pub to the file ~/.ssh/authorized_keys on the other machine.
    Change the permissions of the authorized_keys file using the following command:

    chmod 644 ~/.ssh/authorized_keys

Comments

Popular Posts