====== Public key authentication to remote ssh server ====== Create a SSH key-pair and set a custom name for it to not override the existing one. \\ Change id_rsa with a custom name (for example id_rsa_odcent8) cd ~/.ssh/ ssh-keygen -t rsa -b 4096 Output: Generating public/private rsa key pair. Enter file in which to save the key (/c/Users/odefta/.ssh/id_rsa): id_rsa_odcent8 Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in id_rsa_odcent8 Your public key has been saved in id_rsa_odcent8.pub Copy the public key to the remote machine. ssh-copy-id -i ~/.ssh/id_rsa_odcent8.pub root@remote_ssh_server Connect to remote_ssh_server and edit /etc/ssh/sshd_config: vi /etc/ssh/sshd_config PubkeyAuthentication yes systemctl restart sshd On the host machine (exit from the remote one): Edit ~/.ssh/config file and add: vi ~/.ssh/config Host remote_ssh_server User root IdentityFile ~/.ssh/id_rsa_odcent8 Now you can connect without password: ssh root@remote_ssh_server