1) You can log into a ssh session using either of the following commands.
ssh -l ullas servername
ssh ullas@servername
If you use non standard port then
ssh -p 2222 ullas@servername
2) If its the first time you log into that server it will ask for password along with server RSA Key shown on screen. If you login then a file is created in client ~ullas/ssh/.known_ho sts so that it will recognise the server next time you login.
3) Now let us see how to create a key on client machine and put it on user's
home directory on the server machine. Issue this command on client first.
ssh-keygen -t rsa
It will ask for a passphrase. Enter it. This creates RDA key. Also at the end
it gives a long list string called "finger print". We need to copy this into
"authorized_keys" file on server. So copy it.
4) Now transfer public key to server using command below. For this create a
file called "authorized_keys" in the home directory of user on server in .ssh/
directory. Paste finger print here. File and directory Permission is important. So go into ssh
directory and issue the following command.
# chown yourusername.yourgro upname . *
# chmod 700 .
# chmod 600 *
ssh servername "umask 077; cat >> .ssh/authorized_keys " < ~/.ssh/id_rsa.pub
5) Now if you try to login to server it asks for ssh passphrase. Note that its
not password that is asked.
No comments:
Post a Comment