<!-- Preferences start here * Set PAGETITLE = Barrick Lab :: SSH Public Key Authentication Preferences end here --> ---+ Setting up SSH Public Key Authentication These instructions will allow you to connect as *user1* on machine *FROM* to *user2* on machine *TO* without typing your password for the <code>ssh</code> and <code>scp</code> commands. This can be very useful when doing batch copies (e.g. using <code>batch_run.pl</code> to copy many directories of <code>breseq</code> results) or for machines that you constantly find yourself needing to login to. *Step 1:* Log into machine *FROM* as *user1*. Run the <code>ssh-keygen</code> command. Leave the passphrase empty. (Just hit return when prompted for the passphrase.) On machine *FROM*: <div style="border-color: grey; border-style: solid; border-width: 1px; padding:6px;"><verbatim>$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/user1/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/user1/.ssh/id_rsa. Your public key has been saved in /home/user1/.ssh/id_rsa.pub. The key fingerprint is: d2:e1:78:ac:c1:13:01:f2:a7:84:94:7d:a6:06:f8:1a lab@backup The key's randomart image is: +--[ RSA 2048]----+ | .oo... | |..o+. o. | | ...o+o . | |E ..o+ * . | | o .. * S | |. * | | . | | | | | +-----------------+</verbatim></div> *Step 2:* Create the ssh directory on machine *TO* as *user2* (only needed if it does not already exist): On machine *FROM*: <div style="border-color: grey; border-style: solid; border-width: 1px; padding:6px;"><verbatim> $ ssh user2@TO mkdir -p .ssh user2@TO's password: </verbatim></div> *Step 3:* Add the key that we just created for *user1* on *FROM* as a new line in the <code>.ssh/authorized_keys</code> file in account *user2* on machine *TO*. On machine *FROM*: <div style="border-color: grey; border-style: solid; border-width: 1px; padding:6px;"><verbatim> $ cat .ssh/id_rsa.pub | ssh user2@TO 'cat >> .ssh/authorized_keys' user2@TO's password:</verbatim></div> To add login to additional remote machines, repeat *Step 3*.
E
dit
|
A
ttach
|
Watch
|
P
rint version
|
H
istory
: r3
<
r2
<
r1
|
B
acklinks
|
V
iew topic
|
M
ore topic actions
Barrick Lab
>
ProtocolList
>
ProtocolsSSHPublicKeyAuthentication
Contributors to this topic
JeffreyBarrick
Topic revision: r3 - 2016-03-23 - 20:21:11 - Main.JeffreyBarrick
Barrick Lab
Contact
Research
Publications
Team
Protocols
Reference
Software
UT Austin
Mol Biosciences
ILS
Microbiology
EEB
CSSB
CBRS
The LTEE
iGEM team
SynBioCyc
SynBio course
NGS course
BEACON
Search
Log in
Copyright ©2025 Barrick Lab contributing authors. Ideas, requests, problems?
Send feedback