Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I used this article to set up keys and a user to login to a Ubuntu server from a Windows box using Putty.

I would now like to add an additional ssh user that will login from a MacBook. I used ssh-keygen to generate the local keys but I fail in getting the keys copied up to the server. Here is my bash readout (changed in parts for obvious reasons)

MacBook-Pro:~ joe$ scp -2 -P 50022 -v ~/.ssh/id_rsa.pub newuser@111.222.333.444:
Executing: program /usr/bin/ssh host 111.222.333.444, user newuser, command scp -v -t .
OpenSSH_5.2p1, OpenSSL 0.9.8l 5 Nov 2009
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to 111.222.333.444 [111.222.333.444] port 50022.
debug1: Connection established.
debug1: identity file /Users/joe/.ssh/id_rsa type 1
debug1: identity file /Users/joe/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3
debug1: match: OpenSSH_4.3 pat OpenSSH_4*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.2
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host '[111.222.333.444]:50000' is known and matches the RSA host key.
debug1: Found key in /Users/joe/.ssh/known_hosts:2
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /Users/joe/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/joe/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey). lost connection

share|improve this question
add comment

1 Answer

You need to login using the putty on the windows machine and exit the .ssh/authorized_keys file and add the key that you generated on the mac to the file.

Do not run the command

scp -2 -P 50022 -v ~/.ssh/id_rsa.pub newuser@111.222.333.444:

That will over write the existing key on the server, and it will not work either as the server only accepts key logins.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.