In this article, we will allow you to configure a password-less login for Linux system with SSH keys to connect to a remote Linux server without entering a password which will also increase the trust between two Linux servers for easy file transfer.
SSH is an open source and trusted network protocol that is used to login into remote servers for executing of commands and programs. This is also used to transfer files from one computer to another computer over the network using secure copy (SCP).
# ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: 71:de:c6:b4:c4:8b:31:70:5f:bd:96:60:56:8e:74:b9 root@centos The key's randomart image is: +--[ RSA 2048]----+ | . . .o+. | | o o.=+.. | | . + B...+| | + O o E | | S o * . | | . | | | | | | | +-----------------+
For security, the key itself is protected using a strong passphrase, if a passphrase is used to protect the key, the SSH-agent can be used to cache the passphrase.
ssh-copy-id firstname.lastname@example.org email@example.com's password: Now try logging into the machine, with "ssh 'firstname.lastname@example.org'", and check in: .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting.
ssh email@example.com Last login: Thu Apr 14 17:30:19 2016 from 192.168.2.225 #
Now on words, we are able to login to the remote server without any password
By configuring the above 3 steps we will be able to login to the remote server without entering the password, which is a most security problem that someone might see the password and hack the server these types of authentication will help us to write automatic backups to run and schedule on the remote server.