
SCSxx05/SCSxx20 User Guide 8: Commands
8-13
Advanced Sysadmin Commands
You can access the following features from the command line interface or
administer them using a Linux command line prompt through your network.
Using ssh Keys and keygen Procedures
The following info is taken, with great liberties, from an open source article
discussing ssh and keygen. It is online at:
http://igloo.its.unimelb.edu.au/Webmail/security/msg00010.html.
ssh-agent: Type My Passphrase Once
Ssh-agent makes this all so easy. Basically, it loads my private key into memory once per
session, prompting me for a passphrase to decrypt the key at the time of load. At that
point, I can use this key as if it had no passphrase until I end that session or remove the
key from memory. Since it's never written to disk in its decrypted form, this is pretty darn
safe. Let's see this at work:
[max@miraclehut ~]$ ssh-agent /bin/bash
[max@miraclehut max]$ ssh-add
Need passphrase for /home/max/.ssh/identity (max@miraclehut).
Enter passphrase:
Identity added: /home/max/.ssh/identity (max@miraclehut)
[max@miraclehut jay]$ ssh humperdink@castle
In the first step, I invoke the ssh-agent, giving it a child program to run. The agent gives
access to my key(s) only to its children. I run bash here, so that every program I run in this
new bash shell can have access to my private key. I just as well could have typed "ssh-
agent xterm" or "ssh-agent startx" to give all programs run in a specific xterm or in X
session, respectively, this kind of access.
In the second step, I actually give the agent my key. I decrypt it once, by entering my
passphrase. I won't have to type my passphrase again until I quit bash.
Finally, in the third step, I ssh to my "humperdink" account on the "castle" host. As long as
I have set up that account properly, by appending this account's ~/.ssh/identity.pub to the
end of humperdink@castle ~/.ssh/authorized_keys file, I'll connect with no password
whatsoever! I can keep doing things like this over and over, using scp to copy files, ssh to
login interactively, or ssh user@target "command" to execute commands on a remote
host. When I'm done, I can type exit to kill off the bash shell, and thus the agent.
Komentarze do niniejszej Instrukcji