[Linux] How to configure a passwordless ssh

You are here:
  • Main
  • Linux
  • [Linux] How to configure a passwordless ssh
< All Topics

Hello everybody,

today we’re going to talk about a very useful configuration, that can help you with monitoring, deploying, etc… configuring a passwordless ssh.

First of all, you need to generate a pair of key: your public key and your private key.

$ ssh-keygen -t rsa 

With this commande, you will generate 2 files and the path ~/.ssh: id_rsa and

Now you’ve to create on your destination machine the directory .ssh.

$ ssh dest_user@dest_machine mkdir -p .ssh 

Now, you’ve to copy the text inside the file in a file called authorized_keys under ~/.ssh of the destination machine:

 $ cat .ssh/ | ssh dest_user@dest_machine 'cat >> .ssh/authorized_keys' 

Now you can try to connect to your remote machine, if it doesn’t ask you for a password, you’ve finished:

If it doesn’t work, you need to do this commands on your remote machine:

$ chmod go-w ~/
$ chmod 700 ~/.ssh
$ chmod 600 ~/.ssh/authorized_keys 

Now your passwordless ssh is finally working and you don’t need anymore to remember a lot of password!


Table of Contents