Using SSH keys in Linux/en: Difference between revisions

Jump to navigation Jump to search
Updating to match new version of source page
(Importing a new version from external source)
(Updating to match new version of source page)
Line 3: Line 3:
To create a key pair use the <code>ssh-keygen</code> command. Before running the command check to see if you might already have a key pair. Keys are located in the <code>.ssh/</code> directory in your home directory. The default key names are  <code>id_rsa</code> for the private key and <code>id_rsa.pub</code> for the public key. The command
To create a key pair use the <code>ssh-keygen</code> command. Before running the command check to see if you might already have a key pair. Keys are located in the <code>.ssh/</code> directory in your home directory. The default key names are  <code>id_rsa</code> for the private key and <code>id_rsa.pub</code> for the public key. The command


  ssh-keygen -b 2048 -t rsa
  <source lang="console">
[name@server]$ ssh-keygen -b 2048 -t rsa
</source>


will generate output similar to the following
will generate output similar to the following
Line 35: Line 37:
Finally test the new key by sshing to the remote machine from the local machine with
Finally test the new key by sshing to the remote machine from the local machine with


  ssh -i /home/ubuntu/.ssh/id_rsa USERNAME@ADDRESS
  <source lang="console">
[name@server]$ ssh -i /home/ubuntu/.ssh/id_rsa USERNAME@ADDRESS}}
</source>


where <code>/home/ubuntu/.ssh/id_rsa</code> specifies your private key file and <code>USERNAME</code> is the user name on the remote machine, and <code>ADDRESS</code> is the address of the remote machine.
where <code>/home/ubuntu/.ssh/id_rsa</code> specifies your private key file and <code>USERNAME</code> is the user name on the remote machine, and <code>ADDRESS</code> is the address of the remote machine.
38,760

edits

Navigation menu