Tuesday, June 9, 2020

SSH / SCP key authentication

Many time bash scrip demands scp. OR you may not wish to enter password every time you access remote server.
Generate key for local system.
ssh-keygen -t rsa
Copy key to remote server.
ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.1.1
Now you can ssh / scp without entering password.
For old system not equipped with ssh-copy-id
ssh-keygen -t rsa
scp ~/.ssh/id_rsa.pub root@192.168.1.1:
ssh root@192.168.1.1 ‘cat id_rsa.pub >> .ssh/authorized_keys’

No comments:

Post a Comment