| ryanflannery.net | |
|
Navigation
Link Roll
m & r . net
m & r rate recipes
neal hogan
john schlipf
logic matters
tim gowers
scott aaronson
aatu koskensilta
log blog
it's only a theory
OpenBSD
OpenPorts.se
undeadly.org
advogato
§apio§oft
λ server
xkcd
PhD comics
c & h
s.m.b.
Far Left Side
a.p.o.d.
bbc sci.
life hacker
wvxu/wnku/npr
cet/ket/pbs cinci rollergirls banksy mark ryden todd shorr |
Automating SSH for Scripting
Every time I create a new script to automate some mindless task of mine that
requires logging into remote hosts via ssh (for remote execution, file
uploading/downloading via sftp, etc.) I forget how to setup SSH such that I
don't have to use a password. I always remember the general "idea" (whatever
that means) but I forget the specifics, and have to dig through numerous
ProblemYou want to use SSH in some automated script, but you're always being prompted for a password. Solution
The solution is simple. You want to automate the task of authentication with
SSH. This is done via public/private key pairs. As an example, let's
suppose that user
First, as user # ssh-keygen -t dsa
The Your identification has been saved in /home/worf/.ssh/id_dsa. Your public key has been saved in /home/worf/.ssh/id_dsa.pub. Next, you need to copy the public key to Picard's account on the machine you want to be able to login to. Copy it there however you'd like, such as # scp /home/worf/.ssh/id_dsa.pub picard@enterprise:/home/picard Finally, you just need to add the public key to Picard's list of authorized keys, by doing the following: # cat /home/picard/id_dsa.pub >> /home/picard/.ssh/authorized_keys
You should now be able, as user |