The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
FreeBSD Support
 New Topic  |  Go to Top  |  Go to Topic  |  Search  |  Log In   Newer Topic  |  Older Topic 
 scp without password prompt
Author: khaledhu 
Date:   23-11-05 13:20

hi there, i have problem with using scp between two FreeBSD machines these are specifications for both servers

Server #1 :

OpenSSH_3.5p1 FreeBSD-20030924, SSH protocols 1.5/2.0, OpenSSL 0x0090704f

this is the baclup server

Server #2 :

OpenSSH_2.9 FreeBSD localisations 20020307, SSH protocols 1.5/2.0, OpenSSL 0x0090601f

this is the webserver i want to write script to backup the files for websites to the backup server by using cron tab to automatically so it should not asked about the password when using scp but i tried many things to create a DSA key to use key authentications instead of passwrod authontication so please if any one can help me with step by step manual to do that

thanks in advance
Khaled Hussein

Reply To This Message
 Re: scp without password prompt
Author: halber_mensch 
Date:   23-11-05 16:45

Sure thing. Let's say you are connecting from foo@bar to foo@baz.

Use ssh-keygen on bar as the foo user to create an ssh key first - I use 512 bit dsa keys, but you can do whatever you please:

foo@bar$ ssh-keygen -b 512 -t dsa

ssh-keygen will prompt you for the location to store the key, you can go ahead and let it go to /home/foo/.ssh/id_dsa. Do not enter a passphrase. If you provide a passphrase, then you'll have to interactively provide it each time you use the key.

Once you have done this, you will have two new files in foo@bar's .ssh folder - id_dsa and On baz, create a file in /home/foo/.ssh named 'authorized_keys', and make it readable and writeable only by foo. Copy the contents of the key made by foo@bar into this file. Be very careful about cut'n'paste here - will be a one line file but in most editors it will wrap over several lines, and cutting and pasting from an editor may insert extra line breaks that shouldn't be present.

Now foo@bar can make an ssh connection to foo@baz without providing a password. This includes scp and sftp.


Post Edited (24-11-05 08:17)

Reply To This Message
 Forum List  |  Threaded View   Newer Topic  |  Older Topic 

 User Login
 User Name:
 Remember my login:
 Forgot Your Password?
Enter your email address or user name below and a new password will be sent to the email address associated with your profile.
How to get the most out of the forum