Shreyas Jani

I'm a web designer & software engineer based out of Mumbai.

I write about technology & love documenting the world around me through photography.

Setup passwordless SSH login on Ubuntu

29 May 2020

SSH is a tool for secure system administration, file transfers and other communication across the internet or other untrusted networks. SSH encrypts identities, passwords and transmitted data so that they cannot be eavesdropped and stolen -

SSH supports various authentication mechanisms for a secure connection between the client and server. There are two popular ways to authenticate: password based authentication and passwordless authentication.

After setting up and enabling SSH, you're prompted to enter the remote server's password. Access to the remote server is granted after entering the password. This can be disabled in favour or key based or passwordless authentication using the public keys.

Setup passwordless ssh login

Copy the existing public key to your server using ssh-copy-id. On the commandline, run → ssh-copy-id remote_username@server_ip_address. You will be prompted to enter the remote server's password. Once you're authenticated, the public key will be appended to the remote server's authorized_keys file.

You can close the connection and ssh into the remote server by typing → ssh remote_username@server_ip_address. You should be able to login immediately without being prompted for the password.