scp

Greg Larkin glarkin at FreeBSD.org
Wed Oct 22 18:52:25 PDT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

kalin m wrote:
> hi all...
> 
> i need to do a script to copy a file from a remote machine via scp with
> a key and without a password....
> 
> here is what i'm doing:
> 
> 1. ssh-keygen -t rsa
> 2. scp new_key.pub to user at remote_host (with password)
> 3. on remote_host rename new_key.pub to ~user/.ssh/athorized_keys
> 
> when i try:
> # scp user at remote_host:/files/file file
> 
> i get password prompt...
> 
> what am i missing?!?
> 

Hi Kalin,

Here are a few things to try and check:

- - Run scp with the "-vvv" flag to enable very verbose output.  You may
see something in the log messages during the connection phase that
expose the problem.

- - Check the /var/log/messages file on the host for debug messages from
sshd.  Are there any errors that indicate why public key authentication
doesn't work?

- - Check the /etc/ssh/sshd_config file contents.  Is PubkeyAuthentication
enabled?  You can also change the LogLevel setting if you need more
information emitted to /var/log/messages.  Don't forget to send SIGHUP
to sshd whenever you change sshd_config.

- - Check the permissions on the the ~user/.ssh directory and the
authorized_keys file.  They have to be sufficiently tight (700 and 600,
typically).

Hope that helps, and post back here with any further questions.

Regards,
Greg Larkin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkj/2NQACgkQ0sRouByUApD3jACgnHA1h6XmnOuAEQXsnBjCcZBZ
/k8An2AIMx4CJSXuTDfrPCcBlb9rLFqA
=9z7a
-----END PGP SIGNATURE-----


More information about the freebsd-questions mailing list