Generating public/private rsa key pair. Enter file in which to save the key (/home/author/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/author/.ssh/id_rsa. Your public key has been saved in /home/ec2-user/.ssh/id_rsa.pub. The key fingerprint is: SHA256:7B2G20AHF7PFHIACElEAzEO+i293wReZI49T7MMH1ns author@tutorialflix The key's randomart image is: +---[RSA 2048]----+ |=o==o. ..==o. | |.+ . . .o +o | | .. o.+o | | . .oXo. | | . . OS+o. | |. . =.**o.E | |.. +ooo. | | .. . . | | ... . | +----[SHA256]-----+
Upload Your Public Key to Remote Linux Server
You can upload the key using ssh-copy-id command, which is shipped by the openssh-client package.
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys remote-user@server-ip's password: Number of key(s) added: 1 Now try logging into the machine, with: "ssh 'remote-user@server-ip'" and check to make sure that only the key(s) you wanted were added.
The public key is stored in .ssh/authorized_keys file under the remote user’s home directory. Now ssh into the remote server and you will be able to login without password