From: pk on
laredotornado wrote:

>> If it's available, I'd suggest using "ssh-copy-id", eg
>>
>> ssh-copy-id -i ~/.ssh/id_dsa.pub youruser(a)remotebox
>>
>> which basically does all the hard work for you, then try logging into the
>> remote box as "youruser".
>
> Is "youruser" the login I use on my local machine or the login I use
> to access the remote machine? - Dave

The one you use on the remote box.

From: laredotornado on
On May 20, 1:23 pm, pk <p...(a)pk.invalid> wrote:
> laredotornado wrote:
> >> If it's available, I'd suggest using "ssh-copy-id", eg
>
> >> ssh-copy-id -i ~/.ssh/id_dsa.pub youruser(a)remotebox
>
> >> which basically does all the hard work for you, then try logging into the
> >> remote box as "youruser".
>
> > Is "youruser" the login I use on my local machine or the login I use
> > to access the remote machine? - Dave
>
> The one you use on the remote box.

I found an ssh-copy-id script for my Mac (10.6.3), but I'm still being
prompted for a password. Here is what is happening ...

davea-mbp2:visitlasvegas davea$ ssh-copy-id remoteuser(a)remotebox
remoteuser(a)remotebox's password:
davea-mbp2:visitlasvegas davea$
davea-mbp2:visitlasvegas davea$ ssh remoteuser(a)remotebox
remoteuser(a)remotebox's password:
Last login: Thu May 20 12:43:47 2010 from 99.99.99.99

So I'm still being prompted for the password. The "ssh-copy-id"
script is below. Any other ideas? - Dave


==========Begin ssh-copy-id ==================
#!/bin/sh

if [ $# -eq 0 ] || [ $# -gt 1 ]; then
echo "Usage: ssh-copy-id remoteuser(a)remotehost"
exit;
fi

ssh $1 'mkdir -p ~/.ssh'
cat ~/.ssh/id_dsa.pub | ssh $1 'cat - >> ~/.ssh/authorized_keys'
============End ssh-copy-id ==================
From: pk on
laredotornado wrote:

> I found an ssh-copy-id script for my Mac (10.6.3), but I'm still being
> prompted for a password. Here is what is happening ...
>
> davea-mbp2:visitlasvegas davea$ ssh-copy-id remoteuser(a)remotebox
> remoteuser(a)remotebox's password:
> davea-mbp2:visitlasvegas davea$
> davea-mbp2:visitlasvegas davea$ ssh remoteuser(a)remotebox
> remoteuser(a)remotebox's password:
> Last login: Thu May 20 12:43:47 2010 from 99.99.99.99
>
> So I'm still being prompted for the password. The "ssh-copy-id"
> script is below. Any other ideas? - Dave
>
>
> ==========Begin ssh-copy-id ==================
> #!/bin/sh
>
> if [ $# -eq 0 ] || [ $# -gt 1 ]; then
> echo "Usage: ssh-copy-id remoteuser(a)remotehost"
> exit;
> fi
>
> ssh $1 'mkdir -p ~/.ssh'
> cat ~/.ssh/id_dsa.pub | ssh $1 'cat - >> ~/.ssh/authorized_keys'
> ============End ssh-copy-id ==================

This is a bit different from the one I have on my system, but basically does
the same thing.

At this stage:

- check that the permissions on the remote ~/.ssh directory and files
therein are correct
- check that the remote file ~/.ssh/authorized_keys is correct, perhaps
delete it and start from scratch if you can (or edit it and delete all the
copies of your public key in it)
- make sure the remote system allows public key authentication
- make sure your key isn't blacklisted on the remote system
- make sure your local system is configured to try public key authentication
(eg PubKeyAuthentication yes in /etc/ssh/ssh_config or ~/.ssh/config)
- you can use ssh -v remoteuser(a)remotehost to see what the ssh client is
doing (more v's produce more verbose output, eg -vvvv)
- you can start /usr/sbin/sshd with the -d option on the remote system to
get debug information as well
From: David W. Hodgins on
On Thu, 20 May 2010 17:53:12 -0400, laredotornado <laredotornado(a)zipmail.com> wrote:

> I found an ssh-copy-id script for my Mac (10.6.3), but I'm still being
> prompted for a password. Here is what is happening ...
> cat ~/.ssh/id_dsa.pub | ssh $1 'cat - >> ~/.ssh/authorized_keys'

If I understand correctly, the private dsa key is password protected.
Either run ssh-agent, so you only get prompted once per login,
or remove the password from the key.

mv id_dsa id_dsa.passordprotected
openssl dsa -in id_dsa.passordprotected -out id_dsa

Regards, Dave Hodgins

--
Change nomail.afraid.org to ody.ca to reply by email.
(nomail.afraid.org has been set up specifically for
use in usenet. Feel free to use it yourself.)
From: Chris F.A. Johnson on
On 2010-05-20, laredotornado(a)zipmail.com wrote:
> Hi,
>
> I'm using Mac 10.6.3 and logged in to my machine as "davea". I'm
> trying to set up password-less login to a remote machine, "remote1".
> So I ran this command ...
>
> ssh remotelogin(a)remote1 'echo '`cat ~/.ssh/id_dsa.pub`' >> ~/.ssh/
> authorized_keys'
>
> after entering in the password to the remote machine, I then tried to
> SSH in using
>
> ssh remotelogin(a)remote1
>
> However, I was prompted for a password, which I wanted to avoid.
> Could someone suggest additional steps to troubleshoot this problem?

Check the permissions on the files in ~/.ssh (both local and remote
machines). They must be readable only by you:

chmod 600 ~/.ssh/*

--
Chris F.A. Johnson, author <http://shell.cfajohnson.com/>
===================================================================
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
===== My code in this post, if any, assumes the POSIX locale =====
===== and is released under the GNU General Public Licence =====