How to SSH login to a server without being prompted for the password

boy in white t shirt sitting on chair in front of computer

You purchased a new server, and want to SSH login into it, so you use the command ssh remote_username@server_ip_address , and you are prompted for the password of the remote_username. if you would need to enter the password a couple of times is ok, but if you need to SSH login multiple times that is a pain.

ssh-copy-id is a command that is used to install your public SSH key on a remote server. This allows you to use SSH key-based authentication to log in to the remote server without having to enter a password.

To use ssh-copy-id, you will need to have an SSH key pair. If you don’t have an SSH key pair, you can generate one using the ssh-keygen command. Once you have your SSH key pair, you can use the ssh-copy-id command to install your public key on the remote server.

The syntax of the command is as follows: ssh-copy-id remote_username@server_ip_address You will be prompted for the remote_username’s password one the last time, and after that, you won’t be prompted for the password anymore.

Example of use of the command ssh-copy-id

ssh-copy-id [email protected]

This would install your public SSH key on the remote server at mynicesite.com, using the username “david”.


Posted

in

by

Tags: