Generate a SSH key Pair (Public and Private) in Linux
An SSH key pair can be generated by running the ssh-keygen command:
$ ssh-keygen Generating public/private rsa key pair. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/username/.ssh/id_rsa. Your public key has been saved in /home/username/.ssh/id_rsa.pub. The key fingerprint is: 0a:a8:35:2b:66:10:b9:16:4d:b4:45:c7:fa:fa:c8:1e username@localhost The key's randomart image is: +--[ RSA 2048]----+ | .o.o.. | | .o o .. | |o. o . | | o.. . | |o.+ . . S | |oo o . o | |oo. Eo | |o. ..o | | .+.. | +-----------------+
This will create two files in your .ssh folder: id_rsa that is the private key (keep it private and treat it like a password) and id_rsa.pub that will contain your public key (that is, the key that you will install in the servers that you want to access).