In this article, we will see how to access remote PC/Server via ssh without using password. Password less access can be useful in time saving.

To start with, make sure you have OpenSSH server install on remote PC/Server and OpenSSH client on PC/Device you are going to use.

Steps to be done on Client PC

Pass the ssh-keygen command

[codesyntax lang="sql"]

$ ssh-keygen -t rsa

[/codesyntax]

While passing above command, you will be ask for passphrase, either you can enter a different password for key generated or you can skip and use blank password by pressing enter key twice.

Above command will save files ".ssh/id_rsa.pub" in current user directory

Copy the content of ~/.ssh/id_rsa.pub over clipboard.

Steps to be done on remote PC/Server

  1. Make .ssh directory (If not exist) in home directory of user. eg. "/root/.ssh" or "/home/someuser/.ssh"
  2. Create or append the file "authorized_keys" under ".ssh" directory with content on clipboard(copy content of ~/.ssh/id_rsa.pub on client PC)
  3. Save the file.

 

That's it!!

Now login from client pc to remote pc, you won't be asked password(or in case you given password in ssh-keygen, use that password)

 

TIPS:

You can create shortcut/launcher on your desktop on LINUX machine as [codesyntax lang="text"]
gnome-terminal --tab -e "ssh someuser@remotehost"
[/codesyntax]