ssh access without password

Started by AliceFowell89, Jul 08, 2022, 10:44 AM

Previous topic - Next topic

AliceFowell89Topic starter

Good day!
Please tell me how to organize ssh access without password.

The bottom line is that I need to transfer some files from the local machine to the server via ssh without entering a password.

Now the file transfer works but I have to enter the password every time. Maybe I can add some lines bypassing the password?


in the file /etc/ssh/sshd_config
add or uncomment the following lines:

RSAAuthentication yes
PubkeyAuthentication yes

after that you need to restart the ssh server


To connect your server via ssh without entering a password, you must have a pair of public (public) and private (private) keys.

And then tell the server your public ~/.ssh/ key.

If a key pair has not been created for your user yet, then you need to read how to generate keys. Otherwise, if the keys are created, we immediately execute the ssh-copy-id command:

ssh-copy-id -i ~/.ssh/ user@remotehost


user – the user under which you connect to the remote machine;
remotehost – the ip address of the remote web machine.
-i - option specifies the path to your public key, which we want to upload to a remote server
This command will copy your public key to the remote server and add it to the ~/.ssh/authorized_keys file. If desired, the ~/.ssh/authorized_keys file on the server can be created manually and the contents of your public key ~/.ssh/ can be copied into it.

After that, you can log in to the server using ssh keys without entering a password:

ssh user@remotehost


If after ssh-copy-id still asks for a password, then you need to check the rights on the folder.ssh on the web server. Your home directory should not have write permissions for other users. And the authorized_keys file must have 600 permissions.

Run the following commands:
chmod g-w /home/youruser
chmod 700 /home/youruser/.ssh
chmod 600 /home/youruser/.ssh/authorized_keys

After that, you can easily connect via ssh without entering a password.