Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Oct 2008 20:52:21 -0500
From:      Greg Larkin <glarkin@FreeBSD.org>
To:        kalin m <kalin@el.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: scp
Message-ID:  <48FFD8D5.9050100@FreeBSD.org>
In-Reply-To: <48FFD609.6090206@el.net>
References:  <48FFD609.6090206@el.net>

next in thread | previous in thread | raw e-mail | index | archive | help
-----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@remote_host (with password)
> 3. on remote_host rename new_key.pub to ~user/.ssh/athorized_keys
> 
> when i try:
> # scp user@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-----



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?48FFD8D5.9050100>