Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

For work, I am SSH-ing into a server. I haven't done this for months, so something has changed where it now asks me for a password. Previously, after authenticating it would work. Here's what I typically write to ssh in: ssh -p2222 username@123.12.123.123

I looked at the debug info, and it showed that the server wasn't even asking for the appropriate keyfile. Instead, it first offers an public key that I deleted (id_rsa)..then it turns to private keys...then it asks for a password, which I shouldn't need.

debug1: Found key in /Users/myname/.ssh/known_hosts:40
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,gssapi-with-mic,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/myname/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug1: Trying private key: /Users/myname/.ssh/id_rsa
debug1: Trying private key: /Users/myname/.ssh/id_dsa
debug1: Next authentication method: password

However, when I specify the identity file, it works: ssh -i ~/.ssh/correctkey username@123.12.123.123!

What do these errors mean, and how do I get ssh to work without getting prompted for a password? This is important because I use the GUI called Fugu --the only GUI for SCP available--and I can't use the -i option in it!

Is there something on the server side of the equation that I need to get fixed?

Thanks!

share|improve this question

migrated from stackoverflow.com Apr 21 '13 at 7:22

This question came from our site for professional and enthusiast programmers.

    
If it works when you're manually specifying the client-side ID file, the problem is probably on the client side. –  Cairnarvon Apr 21 '13 at 4:05
    
You must configure SSH to know about non-standard private keys, see my suggestion below –  Stuart M Apr 21 '13 at 4:13
add comment

2 Answers 2

up vote 1 down vote accepted

Just change the names of the files with keys to defaults.

~/.ssh/correctKey --> ~/.ssh/identity (on client machine)
~/.ssh/correctKey.pub --> ~/.ssh/identity.pub (on server machine)

Is that not possible?

share|improve this answer
    
So I would change correctKey to id_dsa on both the client and server? I'll try this with sysadmin soon. –  ridicter Apr 21 '13 at 5:15
    
@ridicter Yes. correctKey -> id_dsa (on client) and correctKey.pub -> id_dsa.pub (on server). If this is a DSA key, that is, and you are using protocol version 2. –  Ziffusion Apr 21 '13 at 5:21
    
@ridicter I think you just need to do this on the client. Because the "-i" option seems to work for you, means that the public key is correctly installed on the server. Just change correctKey to id_dsa on the client, so ssh will try it automatically. This is a DSA key, right? –  Ziffusion Apr 21 '13 at 5:26
    
Thanks, this worked! –  ridicter Apr 21 '13 at 7:32
add comment

If you have a non-default private key file (e.g., ~/.ssh/correctKey), you can configure SSH to be aware of and try using that alternate key by adding an IdentityFile directive to your ~/.ssh/config file (creating that file in the process if it does not already exist). For example,

$ cat ~/.ssh/config
IdentityFile ~/.ssh/correctKey

And there are many other options you can configure in that file too, such as specifying the default port to use on a particular host (e.g., always use port 2222 when logging into 123.12.123.123, or the default username. See sshd_config(5) for details.

Update If your GUI app (Fugu) can't directly read SSH settings from ~/.ssh/config, it appears you can manually pass options to SSH using its "Additional SSH Options" text box:

screenshot of Fugu

You could try passing -i ~/.ssh/correctKey via that text field.

share|improve this answer
    
I forgot that I actually did this a few weeks ago when I was trying to figure things out. Yes, this works and makes it easy to ssh; however, I can't use the config file when using a GUI SCP client. Is there any way to reset things so that I don't have to go through all this wizardry? –  ridicter Apr 21 '13 at 4:20
    
Does your GUI client not invoke the ssh command-line tool, like does it implement SSH internally or something? Or is your GUI app running as a different user which doesn't have read permissions to the private key or config file? Several GUI clients which I use that deal with Git over SSH do respect ~/.ssh/config. –  Stuart M Apr 21 '13 at 4:23
    
I added a workaround specifically for your Fugu GUI app you might try, see my updated answer –  Stuart M Apr 21 '13 at 4:35
    
Hey Stuart, I actually tried your Fugu answer a few weeks ago as well. Unfortunately, it doesn't work. That's why I said I can't use options with Fugu. It's buggy and hasn't been updated in ages. Thanks! –  ridicter Apr 21 '13 at 5:12
    
Have you tried any other OS X SFTP/SCP apps? I prefer Panic's Transmit app, but have used Cyberduck in the past and heard decent things about Macfusion. apple.stackexchange.com/questions/25661/… –  Stuart M Apr 21 '13 at 6:52
show 1 more 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.