Setting up ssh2 / scp2 to Connect Without Passwords By Ed, 12-21-99 Updated 4-19-05 www.narced.com/linux This document will describe how to connect (with ssh2) or copy files (with scp2) from a "local" server to a "remote" server WITHOUT passwords. This document assumes that ssh2 is already installed and works correctly for normal password-based ssh2 connections. Assume there are 2 systems, "local" and "remote". To set up ssh2/scp2 to connect between the servers WITHOUT passwords, do the following: STEP 1: On "local," run the ssh-keygen command, and DO NOT enter an RSA passphrase (just hit "Enter" twice). This will create the following files: $HOME/.ssh2/id_dsa_1024_a $HOME/.ssh2/id_dsa_1024_a.pub Rename these files: id_dsa_1024_a --> local.id_dsa_1024_a and id_dsa_1024_a.pub --> local.id_dsa_1024_a.pub STEP 2: Repeat STEP 1 for "remote". Run ssh-keygen (with no RSA passphrase), and then rename the files: id_dsa_1024_a --> remote.id_dsa_1024_a and id_dsa_1024_a.pub --> remote.id_dsa_1024_a.pub STEP 3: Copy the *.pub files to opposite servers. Copy remote.id_dsa_1024_a.pub to "local" and local.id_dsa_1024_a.pub to "remote". STEP 4: Create authorization and identification files on local and remote. The authorization file should contain the filenames of all of the public keys of remote servers you want to allow to connect. authorization (for local) ------------- Key local.id_dsa_1024_a.pub Key remote.id_dsa_1024_a.pub identification (for local) -------------- IdKey local.id_dsa_1024_a authorization (for remote) ------------- Key remote.id_dsa_1024_a.pub Key local.id_dsa_1024_a.pub identification (for remote) -------------- IdKey remote.id_dsa_1024_a That's it! Now assuming you used the correct usernames, commands like the following should work: ssh2 -l joe remote.server.com scp2 joe@remote:/directory/file /myhome/myfiles/file ssh2 -l bob local.server.com scp2 bob@local:/otherdirectory/differentfile /joe NEW --- NEW --- NEW --- Added 12-18-00 --- NEW --- NEW --- NEW How to setup SSH1 to login using public key authentication By Dave 1. Run 'ssh-keygen1' on MACHINE A and DO NOT enter an RSA passphrase. This will create 'identity' and 'identity.pub' in your '$HOME/.ssh' folder. 2. On MACHINE B, create a file in '$HOME/.ssh' called 'authorized_keys' In this file place the CONTENTS of the file 'identity.pub' that was created on MACHINE A when you ran 'ssh-keygen1' 3. That's it! You can now go from MACHINE A to MACHINE B by using public key authentication. - - - - - - - - - Added 4-19-2005 - - - - - - - - - How to connect from a box running ssh.com's ssh to a box running OpenSSH: [ssh.com] ssh-keygen copy pub key to openssh server's .ssh/ directory [on openssh server] ssh-keygen -i -f id_dsa_1024_a.pub >> authorized_keys2