Use the -i option to specify a new key
ssh -i newkey root@108.166.84.188
How to strip a passphrase from an openssl key
cp filename.key filename.key.encrypted
openssl rsa -in filename.key -out filename.key.nopass
cp filename.key.nopass filename.key
How to add or change a passphrase to an openssl key
If you created an openssl key without a password or if you need to change the password:
ssh-keygen -p -f ~/.ssh/id_rsa
———————————————————————————————–
Starting the SSH Agent
There are two ways to start the ssh-agent. Either will do the trick.
Start the ssh-agent using backquotes to pass information about the agent back to the shell.
`eval ssh-agent` runs an ssh-agent by forking a process off your current
login shell. It outputs some commands to set environment variables:
SSH_AUTH_SOCK or SSH2_AUTH_SOCK and SSH_AGENT_PID or SSH2_AGENT_PID. The eval part causes the shell to interpret the commands output by
ssh-agent, thereby setting the environment variables. (If you leave off
the eval, you’ll see the output.) The problem is that, because it got
forked, it is inaccessible to the shell and keeps running until killed
manually. And even then the environment variables remain set until you
unset them.
Start the ssh-agent and spawn a subshell.
ssh-agent bash
(ssh-agent /bin/sh, ssh-agent /bin/csh, ssh-agent $SHELL, ssh-agent
my-shell-script all work too btw)
With this method, the ssh-agent process runs in the foreground, spawning
a subshell and setting the environment variables up automatically. The
rest of the login session runs in the subshell. When the shell is killed
the cleanup is done automatically. Of course, any background processes
run before initiating the ssh-agent in this way are not accessible from
within the subshell.
1) Add root’s identity
ssh-agent bash
(ssh-agent /bin/sh, ssh-agent /bin/csh, ssh-agent $SHELL, ssh-agent
my-shell-script all work too btw)
2) Add the ssh key to the agent
ssh-add ~/.ssh/id_root_dsa
3) Log onto a machine setup to use ssh-keys
ssh -2 -A root@$MACHINENAME
Copying data from one machine to a tape drive on another.
1) Add root’s identity
ssh-agent bash
(ssh-agent /bin/sh, ssh-agent /bin/csh, ssh-agent $SHELL, ssh-agent
my-shell-script all work too btw)
2) Add the ssh key to the agent
ssh-add ~/.ssh/id_root_dsa
3) Pipe the output of tar to a machine setup to use ssh-keys
tar zcvf – /scratch/vickistan/cl-pdk/ |ssh -A root@$MACHINENAME “cat > /dev/nst2″