Add SSH post and ssh-*.sh scripts
[blog.git] / posts / SSH.mdwn
1 [[!meta  title="Secure Shell"]]
2
3 If you want to get anything done on a remote host, you use [SSH][].
4
5 Password-less SSH
6 -----------------
7
8 Since I use SSH a lot, I've gone through the minimal effort required
9 to setup password-less SSH between the computers on which I have
10 accounts.  Note that you should only keep private keys on computers
11 that you trust (i.e. computers where you are the only admin).
12
13 I don't end up typing these commands very often, so I've created a set
14 of three simple scripts ([[ssh-key.sh]], [[ssh-remote.sh]], and
15 [[ssh-prime.sh]]), since `ssh-<TAB>` is easier to remember than the
16 commands themselves.  With the scripts in your path, run:
17
18     $ ssh-key.sh
19
20 to generate a SSH private/public keypair.  Then run:
21
22     $ ssh-remote.sh me@remote.edu
23
24 to configure your `remote.edu` account to allow passwordless logins
25 from your new key.  After each login, run:
26
27     $ ssh-prime.sh
28
29 and enter your passphrase to start the SSH agent, and tell your shell
30 about the agent with:
31
32     $ . /tmp/$(whoami)/.ssh/.ssh-agent-info-$(hostname)
33
34 I usually prime the SSH agent right after I log in (before running
35 [[screen]] or `startx`) to that new terminals come up knowing about
36 the agent.
37
38 Credits
39 -------
40
41 This sort of thing is the subject of innumerable websites, but due to
42 the fluid nature of the web, they tend to disappear over time.  Thanks
43 to Ted Dustman (at the University of Utah in 2007) for his post (now
44 missing).  Still available related posts:
45
46 * [Kristina Wanous and company at Debian Clusters][DC]
47
48 [[!tag tags/linux]]
49
50 [SSH]: http://en.wikipedia.org/wiki/Secure_Shell
51 [DC]: http://debianclusters.cs.uni.edu/index.php/Password-less_SSH_for_Users