Using SSH keys in Linux/en: Difference between revisions

Jump to navigation Jump to search
Updating to match new version of source page
(Updating to match new version of source page)
(Updating to match new version of source page)
Line 76: Line 76:
</li>
</li>
</ol>
</ol>
=Using ssh-agent=
Having successfully created a key pair and installed the public key on a Compute Canada cluster, you can now login using the key pair. While this is a better solution than using a password to connect to our clusters, it still requires you to type in a passphrase, needed to unlock your private key, every time that you want to login to a cluster. There is however a program, <tt>ssh-agent</tt>, which stores your private key in memory on your local computer and provides it whenever another program on this computer needs it for authentification. This means that you only need to unlock the private key once, after which you can login to a remote cluster many times without having to type in the passphrase again.
You can start the <tt>ssh-agent</tt> program using the command
{{Command|eval `ssh-agent`
}}
After you have started the <tt>ssh-agent</tt>, which will run in the background while you are logged in at your local computer, you can add your key pair to those managed by the agent using the command
{{Command|ssh-add
}}
Assuming you installed your key pair in one of the standard locations, the <tt>ssh-add</tt> command should be able to find it. Using the <tt>ssh-add -l</tt> option will show which private keys currently accessible to the <tt>ssh-agent</tt>.
Note that many contemporary Linux distributions as well as macOS now offer graphical "keychain managers" that can easily be configured to also manage your SSH key pair, so that logging in on your local computer is enough to store the private key in memory and have the operating system automatically provide it to the SSH client during login on a remote cluster. You will
then be able to login to Compute Canada clusters without ever typing in any kind of passphrase. 
[[Category:Connecting]]
[[Category:Connecting]]
38,760

edits

Navigation menu