Networking | Hardware | Software | Multimedia | System | Unix&Linux | MBA

Home>>Software>>Can't use SSH with key pair from OSX to Linux box

Can't use SSH with key pair from OSX to Linux box

exess
04-24-2005, 09:54 AM
Hi all,

I recently decided to change setup on sshd on my server. I added AllowRootLogin = no and PubkeyAuthentication yes to the config and I am trying to use DSA keys to get things strainght. I already have generated a keys pair. As I'm using Mac OS X on my workstation, the syntax is quite identical to what you find on linux. So, the keys are in ~/.ssh/ in my home directory on the Mac. The id_dsa.pub key looks like this :
ssh-dss AAAAB3NzaC1kc3MAAACBAJ (blah blah) jjctvB7JHg1tdKs= xs@g4xs.local
xs being my local account and g4xs being the workstation name. Actually I use this key pair for identification on Sourceforge CVS server. Seems to work quite fine in that case. I have copied the id_dsa.pub key to /home/xspirlet/.ssh/authorized_keys (xspirlet being the account with which I intend to log in on the server).

When logging in via ssh, I still get a password challenge :
$ ssh 192.168.1.14 -l xspirlet
Password:
If I add ChallengeResponseAuthentication no to sshd config (and restart), I don't get a password challenge, but it doesn't work either :
$ ssh 192.168.1.14 -l xspirlet
Permission denied (publickey).
Here is the output from ssh -v to the same host...
$ ssh -v 192.168.1.14
OpenSSH_3.6.1p1+CAN-2004-0175, SSH protocols 1.5/2.0, OpenSSL 0x0090702f
debug1: Reading configuration data /etc/ssh_config
debug1: Rhosts Authentication disabled, originating port will not be trusted.
debug1: Connecting to 192.168.1.14 [192.168.1.14] port 22.
debug1: Connection established.
debug1: identity file /Users/xs/.ssh/identity type -1
debug1: identity file /Users/xs/.ssh/id_rsa type -1
debug1: identity file /Users/xs/.ssh/id_dsa type 2
debug1: Remote protocol version 2.0, remote software version OpenSSH_3.9p1
debug1: match: OpenSSH_3.9p1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_3.6.1p1+CAN-2004-0175
debug1: Miscellaneous failure
No credentials cache found

debug1: Miscellaneous failure
No credentials cache found

debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST 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 '192.168.1.14' is known and matches the RSA host key.
debug1: Found key in /Users/xs/.ssh/known_hosts:1
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,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Trying private key: /Users/xs/.ssh/identity
debug1: Trying private key: /Users/xs/.ssh/id_rsa
debug1: Offering public key: /Users/xs/.ssh/id_dsa
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Next authentication method: keyboard-interactive

Anyone has an idea ?

David Brinegar
04-24-2005, 11:01 AM
When ssh says:

Permission denied (publickey).

and

debug1: Offering public key: /Users/xs/.ssh/id_dsa

it looks like you've accidentally copied the public key (id_dsa.pub) over the private key (id_dsa). Hope that helps!

exess
04-24-2005, 11:37 AM
Nope, sorry. Files are correct (just checked them). I tried to change ssh_config Identityfile to ~/.ssh/id_dsa.pub, but it didn't change anything at all... I guess there is a misunderstanding problem between the Mac and OpenSSH on the linux box... Any other idea?

Gnarlodious
04-24-2005, 12:22 PM
It's not a well documented feature, but SSH examines every path component of the target authorized_keys file and if access is too liberal it rejects the offer.
In my case, since my userfolder is a partition it is in the "Volumes" folder. Permissions on my Volumes folder were a little too open, so SSH failed.

Check the system.log for a report on the other machine.

exess
04-25-2005, 01:23 AM
Even more stupid than that : on the server side, .ssh directory was owned by root:root. I chowned it and now tadaaaam it works ! (what a dick I am!) Anyway, I now have to provide the passphrase when I log. Is it mandatory (i.e. I'll have to enter it everytime unless I create another key without a passphrase) or may I avoid this ?

Gnarlodious
04-25-2005, 08:54 AM
You don't need to enter a password. If you make the key and enter the password there you will need one to login, but it's a high-security feature. I leave all mine blank and none is required.

exess
04-25-2005, 09:57 AM
Well, maybe I'm paranoid but I'd rather use a passphrase anyway. And you just have to use "sshkeychain" (a subset of the excellent ssh-agent for Mac OS X) to add your ssh key pair to keychain and unlock them at login... ;)

Gnarlodious
04-25-2005, 10:08 AM
That is an awful lot of trouble. You should use that method if you suspect anyone will have physical access to your machine and steal your key. Nothing I do needs that much security :=)


 

TOP

Bodycote says profit i
Microsoft muses on fre

For more info

Bodycote says profit i
Microsoft muses on fre
after 10.1.3, MO remov
how to get a Voodoo 3/
Wacom USB Tablet Drive
HP 932C driver? 
Appletalk & Airpor
Olympus e100 won't "in
Lost printer in Classi
Hard Drive to Hard Dri

News Archive

Bodycote says profit i
Restructuring bites in
Office Open XML could 
Microsoft muses on fre
Connect to.... getting
sshd pb get_real_comma
Could be worse...... 
Cisco console port con
RDP Client 
scripting  internet co

Related stories:

Apache not accepting https connections after 10.3.9 update and new ethernet card
USB Modem troubles after upgrading to Panther 10.3.6
load balancing
xsan
How can I setup an inexpensive wireless LAN?
Send text file to a tcp/ip address
Megabits to Megabytes
How to find out if WEP is active

Copyright@2004-2005 www.zzcoke.com All Right Reserved

advanced web statistics