Labels

Sunday, May 30, 2021

SSH free password login

step1 :  Create public and private keys using ssh-key-gen on local-host

$ssh-keygen

step 2: Copy the public key to remote-host using ssh-copy-id

$ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host

step 3: login remote host and change file permission

Change the permissions of .ssh to 700

$chmod 700 .ssh

Change the permissions of .ssh/authorized_keys to 640

$chmod 640 .ssh/authorized_keys

step 4: login from local host
ssh remote-host

(Optional) Alias for remote-host name
In local host
$vi .ssh/config
and add following lines
    Host short-name
    Hostname remote-host-name
    User your_user_name
    Port your_remote_host _port