SSH is often used to login from one system to another without requiring passwords. This will be required when you run a cluster, it will not ask you for the password again and again.
steps:
1. First
log in on Host1 with user user1 and generate a pair of authentication keys.
Do not
enter a passphrase:
user1@Host1:~>
ssh-keygen –t rsa
2. Now
use ssh to create a directory ~/.ssh as user user2 on Host2 .
( if directory already exists, then no issues with that)
user1@Host1:~>ssh
user2@Host2 mkdir –p .ssh
user2@Host2’s
password:
3. Finally
append Host1's new public key to user2@Host2:.ssh/authorized_keys and
enter
Host2's password one last time:
user1@Host1:~>cat
/home/hadoop/.ssh/id_rsa.pub | ssh user2@Host2 'cat >> .ssh/authorized_keys'
hadoop@Host2’s
password:
now you can login to Host2 using user2 from Host1 machine
user1@Host1:~>ssh user2@Host2 hostname
NOTE: If you face any issue while logging in, please make the below changes:
- Put the public key in .ssh/authorized_keys2
- Change the permissions of .ssh to 700
- Change the permissions of .ssh/authorized_keys2 to 640
No comments:
Post a Comment