this is obsolete doc -- see http://doc.nethence.com/ instead

SSH without a password 

 

For unices (with the OpenSSH client) 

Create a key pair on the client

cd ~/
mkdir -p .ssh/
chmod 700 .ssh/
cd .ssh/
ssh-keygen -t dsa -P ''
cat id_dsa.pub

copy/paste the public key on the server

cd ~/
mkdir -p .ssh/
chmod 700 .ssh/
cd .ssh/
vi authorized_keys2

Note. the trailing '2' for SSH protocol 2 only 

 

For windows hosts (with the PuTTY client) 

Instead of deploying the putty executable alone, use the installer (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) which will install all the components. We precisely need puttygen, pageant, putty and eventually plink. 

 

Run the puttygen utility to generate a pair of private/public keys, 

C:\Program Files\PuTTY\puttygen.exe
select SSH-2 RSA
Generate
Save public key (filename.pub.key)
Save private key (filename.sec.ppk)

note. enter a passphrase if you like 

and copy/paste the public key to hosts's, 

vi ~/.ssh/authorized_keys2

 

Load your keys with pageant (also remembers the passphrase -- connect once -- if you're using one), 

C:\Program Files\PuTTY\pageant.exe
right click on the tray icon > add key (load filename.sec.ppk)

 

Eventually start pageant at boot, 

Start menu > Programs > startup (right click / open)
New > shortcut
"C:\Program Files\PuTTY\pageant.exe" c:\path\to\putty.sec.ppk

 

You can now use plink from the command line or batch scripts to do what ever you need e.g., 

"C:\Program Files\PuTTY\plink.exe" root@HOST "shutdown -h -P now"

 

If you use the standard putty gui, eventually save a session with auto-login username, 

Connection > data > auto-login username : USERNAME

 

Ref. http://www.ualberta.ca/CNS/RESEARCH/LinuxClusters/pka-putty.html