Thankfully, you can bypass this step by enabling passwordless SSH login. We’ll show you how to use the ssh-copy-id command to do so.

How to Use SSH Without a Password

To enable passwordless login via SSH, all you need to do is copy your public key to the remote server. An SSH key is really a pair of two keys: one public and one private. A remote SSH server will use these to authenticate your identity before you can connect.

You can easily create your SSH key pairs using the ssh-keygen command. Once ssh generates the keys, copy your public key to the remote server. This will ensure you don’t need to type your SSH password on subsequent logins.

Create Public and Private SSH Keys

Simply fire up your terminal and enter the following command to generate your SSH key pairs:

Keep pressing enter at each prompt until the program completes and creates the key files.

Add Public SSH Key to the Server

Now that you have created your SSH keys, you need to add the public key to your remote server. You can do this with the ssh-copy-id command:

Type the above command in your terminal and replace user and remote-host with your username and the hostname/IP of the remote machine.

Connect to SSH Server Without a Password

You’re all set to log in without a password once you add the public key to the server via ssh-copy-id. You can test it for yourself using the following command:

Get Rid of Passwords Using ssh-copy-id

Using ssh-copy-id, you can upload a public key to a remote server and connect without a password. However, you should not enable passwordless authentication for all systems. Instead, use it to access systems you use frequently. If you’re new to this, try learning how to set up SSH and configure your setup.