The ssh-copy-id command provides an easy and convenient way of copying the public SSH key to a remote host. Copy SSH Public Key to Remote Linux Server With the SSH keys successfully created, the next step will be to save the Public key to the remote system in readiness for authentication.
The id_rsa.pub is the public key and it is saved on the remote host that you want to connect to.Divulging it can lead to a serious breach of your remote server. The id_rsa is the private key and should be kept secret and confidential.To confirm this, run the command: $ ls -la ~/.ssh With the default options, the SSH keys are saved in the ~/.ssh directory inside your home directory. This is the output generated after successful command execution. Add SSH Passphrase in Rocky Linuxįinally, the SSH key pair ( public and private keys) will be saved on your local system on the specified path. However, you can leave this blank if your intention is to configure passwordless SSH authentication between your local system and other remote hosts.įor now, we will leave this blank and press ENTER. This is an optional step and it provides an added layer of protection to bar unauthorized users from using the keys for authentication. Next, you will then be prompted for a passphrase. Selecting ‘Yes’ destroys the current keys and generates new ones. Overwriting the keys means that authentication will not be possible using the previous keys. If SSH keys already exist, you will get the following prompt and you will be prompted to overwrite it. So, press ENTER to save the keys in the ~/.ssh directory on your home directory. You can define your custom file, but in this illustration, we will go with the defaults By default, the keys are saved in the ~/.ssh directory on your home directory.
You will first be required to provide the file in which the keys will be saved.
#Ssh copy id no known hosts series#
After running the ssh-keygen command, a series of prompts will follow.