Misc Ssh Tools


Table of Contents

cmd:keychain 
Usage 
Source 
Install 
RSA authentication configuration 
Using keychain 
cmd:scp 
Usage 
Help 
How to send multiple commands 

cmd:keychain 

Usage 

keychain ~/.ssh/id_rsa
source ~/.keychain/$HOSTNAME-sh

Install 

bzip2 -d -c ~+1/keychain-2.0.2.tar.bz2 | tar xvf -
cp keychain-2.0.2/keychain /usr/bin

RSA authentication configuration 

$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/tong/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/tong/.ssh/id_rsa.
Your public key has been saved in /home/tong/.ssh/id_rsa.pub.
The key fingerprint is:
e4:84:2b:00:51:c1:e8:f3:e1:77:ad:1d:c6:41:54:eb tong@lab1-18.for...
scp /home/tong/.ssh/id_rsa.pub root@lab1-22:

Since RSA authentication isn't fully set up yet, we'll be prompted to enter our password on remotebox.

Then, log in to remotebox and append the public key to the ~/.ssh/authorized_keys file like so:

cd
mkdir .ssh
chmod 700 !$
cat ~/id_rsa.pub >>~/.ssh/authorized_keys

Now, with RSA authentication configured, we should be prompted to enter our RSA passphrase (rather than our password) when we try to connect to remotebox using ssh.

$ ssh root@lab1-22
Enter passphrase for /home/tong/.ssh/id_rsa:

Hurray, RSA authentication configuration complete! If you weren't prompted for a passphrase, see orignial doc.

Using keychain 

Init 

Only need to to the following once after Linux is booted.

$ keychain ~/.ssh/id_rsa
KeyChain 2.0; http://www.gentoo.org/projects/keychain
 Copyright 2002 Gentoo Technologies, Inc.; Distributed under the GPL
 * All previously running ssh-agent(s) have been stopped.
 * Initializing /home/tong/.keychain/lab1-18.forestry.utoronto.ca-sh file...
 * Initializing /home/tong/.keychain/lab1-18.forestry.utoronto.ca-csh file...
 * Starting new ssh-agent
 * 1 more keys to add...
Enter passphrase for /home/tong/.ssh/id_rsa:
Identity added: /home/tong/.ssh/id_rsa (/home/tong/.ssh/id_rsa)