Mobile app version of vmapp.org
Login or Join
Carla537

: Still prompted for a password after adding SSH public key to a server I'm attempting to setup a git repository on my Dreamhost web server by following the "Setup: For the Impatient" instructions

@Carla537

Posted in: #Authentication #Webserver

I'm attempting to setup a git repository on my Dreamhost web server by following the "Setup: For the Impatient" instructions here. I'm having difficulty setting up public key access to the server.

After successfully creating my public key, I ran the following command:

cat ~/.ssh/[MY KEY].pub | ssh [USER]@[MACHINE] "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"


...replacing the appropriate placeholders with the correct values.

Everything seemed to go through fine. The server asked for my password, and, as far as I can tell, executed the command. There is indeed a ~/.ssh/authorized_keys file on the server.

The problem: When I try to SSH into the server, it still asks for my password. My understanding is that it shouldn't be asking for my password anymore. What am I missing?

EDIT: SSH -v Log:

Macbook:~ michaeleckert$ ssh -v [USER]@[SERVER URL]
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: /etc/ssh_config line 53: Applying options for *
debug1: Connecting to [SERVER URL] [[SERVER IP]] port 22.
debug1: Connection established.
debug1: identity file /Users/michaeleckert/.ssh/id_rsa type -1
debug1: identity file /Users/michaeleckert/.ssh/id_rsa-cert type -1
debug1: identity file /Users/michaeleckert/.ssh/id_dsa type -1
debug1: identity file /Users/michaeleckert/.ssh/id_dsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.5p1 Debian-6+squeeze3
debug1: match: OpenSSH_5.5p1 Debian-6+squeeze3 pat OpenSSH_5*
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: Server host key: RSA [STRING OF NUMBERS AND LETTERS SEPARATED BY SEMI-COLONS]
debug1: Host ‘[SERVER URL]' is known and matches the RSA host key.
debug1: Found key in /Users/michaeleckert/.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: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /Users/michaeleckert/.ssh/id_rsa
debug1: Trying private key: /Users/michaeleckert/.ssh/id_dsa
debug1: Next authentication method: password
[USER]@[SERVER URL]'s password:
debug1: Authentication succeeded (password).
Authenticated to [SERVER URL] ([[SERVER IP]]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8

Welcome to [SERVER URL]

Any malicious and/or unauthorized activity is strictly forbidden.
All activity may be logged by DreamHost Web Hosting.

Last login: Sun Nov 3 12:04:21 2013 from [MY IP]
[[SERVER NAME]]$

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Carla537

2 Comments

Sorted by latest first Latest Oldest Best

 

@Rambettina238

Turns out the solution was very simple: rename my two public key files to id_rsa and id_rsa.pub. I have no idea why this is what they have to be called. Please feel free to edit this answer to make it more informative.

10% popularity Vote Up Vote Down


 

@Harper822

Some things to check:

On the server:


Change the ~/.ssh/authorized_keys file permissions using:
chmod 600 ~/.ssh/authorized_keys
Change the ~/.ssh/authorized_keys file owner using:
chown `whoami` ~/.ssh/authorized_keys
Check that the ~/.ssh/authorized_keys file is not empty:
(cat ~/.ssh/authorized_keys should display some output)


(Steps one and two are recommended in the OpenSSH FAQ.)

On the client


Are you logging in with the same user account as the one you added the key for on the server? (i.e. Is the user in the ssh USER@ip command you're using to connect the same as the USER in the command you copied the file to the server with?)
Connect using SSH verbose mode (ssh -v user@ip) and edit your question to add the output (with any IP addresses, usernames and hostnames masked).

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme