Thursday, July 7, 2016

ssh: Login to remote host without password

Most of remote systems are secured by SSH, and to gain remote control with terminal, you would need to ssh into the server. You will be prompted to login with your password on every session. To avoid typing password everytime, you need to setup as authorized client. Here is how you can do that with ssh key.

First on your own client machine, generate the $HOME/.ssh/id_rsa.pub file:

bash> ssh-keygen
# When prompted to enter password, simply hit ENTER key to skip it!
bash> cat  ~/.ssh/id_rsa.pub
xxxyyyzzz zemian@myhost
# You will see a very long string instead of "xxxyyyzzz".

Now you need to copy this public key string into your remote host. You need to ssh into the remote host with your valid password first to setup. If successful, the subsequent ssh into the remote host will not prompt you for password!

bash> ssh myremotehost
# Enter password to gain access

After you are in the remote host:

myremotehost> vim ~/.ssh/authorized_keys
#Paste and append the "xxxyyyzzz" into above file.

If you don’t already have the ~/.ssh/authorized_keys file on remote host, then create it, but ensure you don’t let other users or groups to access it. Use command like this to change the permission:

bash> chmod g-rw,o-rw ~/.ssh/authorized_keys

The cool thing about this is that it affects all ssh related commands, such as scp will now work without prompting you for password!

Have a productive day!

15 comments:

  1. GOOD POST. Thank you For Sharing This Information.

    SRI ANNAPOORNESHAWARI ASTROLOGY CENTER.Best Astrologer In dhule

    ReplyDelete
  2. Thank you for your post. This is excellent information

    SRIKRISHANA ASTROLOGY.Best Astrologer In Udupi

    ReplyDelete
  3. Thanks for sharing, nice post! Post really provice useful information!
    For sofa renovation contact thesofastore they gives best
    Sofa Refurbishing in Chikkalasandra,Bangalore

    ReplyDelete
  4. Hii your blog is looking good.Thanks for sharing this information and keep posting.
    For web design & development service contact Multisoft digital technologies, They have
    SEO company in Mangalore

    ReplyDelete
  5. Thanks for sharing this information with us and it was a nice Content.
    Click here know more aboutBridal Jewellery for Rent in Indiranagar

    ReplyDelete
  6. Very good article, Thank you
    For sofa renovation contact thesofastore they gives best
    Best Sofa Repair Services in Kundalahalli,Bangalore

    ReplyDelete
  7. Zemian Blog: A Programmer'S Journal: Ssh: Login To Remote Host Without Password >>>>> Download Now

    >>>>> Download Full

    Zemian Blog: A Programmer'S Journal: Ssh: Login To Remote Host Without Password >>>>> Download LINK

    >>>>> Download Now

    Zemian Blog: A Programmer'S Journal: Ssh: Login To Remote Host Without Password >>>>> Download Full

    >>>>> Download LINK y9

    ReplyDelete
  8. Zemian Blog: A Programmer'S Journal: Ssh: Login To Remote Host Without Password >>>>> Download Now

    >>>>> Download Full

    Zemian Blog: A Programmer'S Journal: Ssh: Login To Remote Host Without Password >>>>> Download LINK

    >>>>> Download Now

    Zemian Blog: A Programmer'S Journal: Ssh: Login To Remote Host Without Password >>>>> Download Full

    >>>>> Download LINK IT

    ReplyDelete
  9. Thanks for sharing such a wonderful blog. All things were explained in such a way that they are easy to understand regarding SSH Keys

    ReplyDelete
  10. Much impressed by this article.

    Thanks for sharing.

    John Deere Tractor

    ReplyDelete
  11. Cool and that i have a neat give: Whole House Renovation Cost Calculator split level kitchen remodel

    ReplyDelete
  12. Thank You and I have a swell provide: How Many Houses Has Hometown Renovated home addition remodeling

    ReplyDelete
  13. Thank You and that i have a dandy present: Where Is Charlotte Church House Renovation exterior home remodel contractors

    ReplyDelete