LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-19-2009, 02:54 AM   #1
robotronic
LQ Newbie
 
Registered: Jul 2009
Posts: 15

Rep: Reputation: 0
no password ssh not working as it used to


I backup stuff on my home machine by rsyncing with my work machine. I have to pull from work because I can't see my work machine externally.

The process is usually as follows:
1) logon to visible machine at work
2) login to my machine
3) switch to root (i have a external HD that only root can see)
4) run rsync script

Since there are several rsync commands I set up no password ssh by copying the root@work public key in to my authorised keys. THen out of the blue this stopped working.

I cannot get it to work again, even by starting all over from scratch. On my home network public keys work.

I allow access via ssh to my home network using a non standar port and my hostname is set via ddclient, although my ISP tends to give me the same IP address at all times anyway.

How can I trouble shoot this?

Many thanks,

Dave
 
Old 08-19-2009, 05:24 AM   #2
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by robotronic View Post
I backup stuff on my home machine by rsyncing with my work machine. I have to pull from work because I can't see my work machine externally.

The process is usually as follows:
1) logon to visible machine at work
2) login to my machine
3) switch to root (i have a external HD that only root can see)
4) run rsync script

Since there are several rsync commands I set up no password ssh by copying the root@work public key in to my authorised keys. THen out of the blue this stopped working.

I cannot get it to work again, even by starting all over from scratch. On my home network public keys work.

I allow access via ssh to my home network using a non standar port and my hostname is set via ddclient, although my ISP tends to give me the same IP address at all times anyway.

How can I trouble shoot this?

Many thanks,

Dave

start with manual ssh connection using verbose flag and tail -f logs at remote side at the same time

Code:
ssh -vv user@host
[/code]
 
Old 08-19-2009, 07:03 AM   #3
choogendyk
Senior Member
 
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,197

Rep: Reputation: 105Reputation: 105
Also, are you watching /var/log/auth.log? I presume since you say "my work machine" that you are in control of that machine? So another sysadmin would not have blocked root logins?

If I were the sysadmin, I would have blocked it. That's a standard security practice. I use a restricted user account for backups and use sudo when needed. The keys are also restricted so that the connections can only do what I originally intended. It works just fine for doing backups, and root is not allowed to login remotely.

By the way, if you aren't familiar with it already, http://sial.org/howto/openssh/publickey-auth/ is a pretty standard reference for setting up keys. It also has some debugging notes.
 
Old 08-19-2009, 11:00 AM   #4
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Quote:
Originally Posted by robotronic
THen out of the blue this stopped working.
My WAG is that you have sshd's StrictModes enabled, and that you changed your user's home directory permissions on the server side. e.g. /home/foo can not be group writable or world writable, or pubkey authentication will not work.

A quick -
Code:
$ chmod go-w /home/foo
- will correct that.

While you're reviewing and fixing that, also confirm that /home/foo/.ssh and /home/foo/.ssh/authorized_keys is readable by only foo.
 
Old 08-20-2009, 03:31 AM   #5
robotronic
LQ Newbie
 
Registered: Jul 2009
Posts: 15

Original Poster
Rep: Reputation: 0
Hi,

@choogendyk So I have full root access to my work machine. I'm an academic and things are a little more relaxed. root logins over ssh are not allowed though. I'm backing up as root for some reason that I can't remember. I think I wanted to mount the drive as read only for my user account.

Here is the verbose output of ssh. I think the lines at the end are telling what is going wrong, but I don't understand it.

Is it trying to access as root on my home machine even though the ssh command is user@homemachine?:

Quote:
debug2: key: /root/.ssh/authorized_keys ((nil))
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/authorized_keys
debug2: we did not send a packet, disable method
Quote:
ssh -vv user@homemachine -p XXXXX
OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to homemachine [XX.XX.XXX.XX] port XXXXX.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/authorized_keys type -1
debug1: loaded 1 keys
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-5ubuntu1
debug1: match: OpenSSH_5.1p1 Debian-5ubuntu1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.3
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_init: found hmac-md5
debug1: kex: server->client aes128-cbc hmac-md5 none
debug2: mac_init: found hmac-md5
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug2: dh_gen_key: priv key bits set: 126/256
debug2: bits set: 489/1024
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'lobster.parishouse.mine.nu' is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:3
debug2: bits set: 552/1024
debug1: ssh_rsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /root/.ssh/authorized_keys ((nil))
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/authorized_keys
debug2: we did not send a packet, disable method
debug1: Next authentication method: password
This is the tail of /var/log/auth.log on my home machine

Quote:
Aug 20 09:09:01 homemachine CRON[6129]: pam_unix(cron:session): session opened for user root by (uid=0)
Aug 20 09:09:01 homemachine dbus-daemon: Rejected send message, 1 matched rules; type="method_call", sender=":1.26" (uid=1000 pid=4733 comm="/usr/lib/indicator-applet/indicator-applet --oaf-a") interface="org.freedesktop.DBus.Properties" member="Get" error name="(unset)" requested_reply=0 destination=":1.41" (uid=0 pid=6129 comm="/USR/SBIN/CRON "))
Aug 20 09:09:01 homemachine CRON[6129]: pam_unix(cron:session): session closed for user root
Aug 20 09:10:01 homemachine CRON[6209]: pam_unix(cron:session): session opened for user root by (uid=0)
Aug 20 09:10:01 homemachine dbus-daemon: Rejected send message, 1 matched rules; type="method_call", sender=":1.26" (uid=1000 pid=4733 comm="/usr/lib/indicator-applet/indicator-applet --oaf-a") interface="org.freedesktop.DBus.Properties" member="Get" error name="(unset)" requested_reply=0 destination=":1.42" (uid=0 pid=6209 comm="/USR/SBIN/CRON "))
Aug 20 09:10:02 homemachine CRON[6209]: pam_unix(cron:session): session closed for user root

Thanks,

Dave
 
Old 08-20-2009, 04:13 AM   #6
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by robotronic View Post
Hi,

@choogendyk So I have full root access to my work machine. I'm an academic and things are a little more relaxed. root logins over ssh are not allowed though. I'm backing up as root for some reason that I can't remember. I think I wanted to mount the drive as read only for my user account.

Here is the verbose output of ssh. I think the lines at the end are telling what is going wrong, but I don't understand it.

Is it trying to access as root on my home machine even though the ssh command is user@homemachine?:





This is the tail of /var/log/auth.log on my home machine




Thanks,

Dave
looks like a key pair mismatch
i say this because


Code:
debug2: key: /root/.ssh/authorized_keys ((nil))
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/authorized_keys
debug2: we did not send a packet, disable method
debug1: Next authentication method: password
should have been more like

[code]
debug1: Trying private key: /home/root/.ssh/identity
debug1: Trying private key: /home/root/.ssh/id_rsa
debug1: Offering public key: /home/root/.ssh/id_dsa
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-dss blen 433




you may get some more info from

Code:
/var/log/secure
but i doubt you will need that.
points to keypair mismatch

Last edited by centosboy; 08-20-2009 at 04:20 AM.
 
Old 08-21-2009, 03:14 AM   #7
robotronic
LQ Newbie
 
Registered: Jul 2009
Posts: 15

Original Poster
Rep: Reputation: 0
I don't really understand. I generated a fresh pair in .ssh as root on my work machine:

Quote:
ssh-keygen -t dsa -f id_dsa -P ''
I then cat id_dsa.pub into .ssh authorized_keys2 on my home machine.

Which keys are mismatched?

Many thanks,

Dave
 
Old 08-21-2009, 07:17 AM   #8
choogendyk
Senior Member
 
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,197

Rep: Reputation: 105Reputation: 105
authorized_keys2? I thought more recent versions of OpenSSH had dropped that distinction. Try authorized_keys, and see if that does something. Also, do look at

Quote:
Originally Posted by choogendyk View Post
... http://sial.org/howto/openssh/publickey-auth/ is a pretty standard reference for setting up keys. It also has some debugging notes.
 
Old 08-21-2009, 07:54 AM   #9
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by choogendyk View Post
authorized_keys2? I thought more recent versions of OpenSSH had dropped that distinction. Try authorized_keys, and see if that does something. Also, do look at

the sshd_config file will tell you if ssh looks for authorized_keys or authorized_keys2.


the key isnt being found......according to the verbose output
 
Old 08-21-2009, 07:55 AM   #10
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by robotronic View Post
I don't really understand. I generated a fresh pair in .ssh as root on my work machine:



I then cat id_dsa.pub into .ssh authorized_keys2 on my home machine.

Which keys are mismatched?

Many thanks,

Dave
my bad

looks like authorized_keys is being checked.

Code:
debug2: key: /root/.ssh/authorized_keys ((nil))
debug1: Authentications that can continue: publickey,password
so append the key there./....
 
Old 08-21-2009, 03:50 PM   #11
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
@robotronic: Have you explored my suggestion yet?
 
Old 08-24-2009, 02:49 AM   #12
robotronic
LQ Newbie
 
Registered: Jul 2009
Posts: 15

Original Poster
Rep: Reputation: 0
@anomie Yes thanks.

I should point out that I can log in with public keys from two other machines: 1) the a laptop on my home network 2) a work machine visible to the outside world.

This implies to me that I have things set up correctly at this end. The machine I am rsyncing from is not visible externally (which is why I am pulling to it). This is the one that is not working, (Although it used to!!!!).

Now, here is what I don't get:

Code:
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /root/.ssh/authorized_keys ((nil))
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/authorized_keys
debug2: we did not send a packet, disable method
Why is it looking at /root/ssh/authorized_keys?

Okay so the work user is root, but it is logging on as myname:

Code:
root@workdt:# ssh myname@home -p xxxxx
Shouldn't it be looking in /home/myname/.ssh/authorized_keys?????

Many thanks for all your help so far!

Dave
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SSH login not working following password change CaptainReboot Linux - Software 14 03-20-2008 06:41 AM
need help with no password ssh and ssh-agent hedpe Linux - Networking 3 02-08-2007 08:49 PM
ssh not prompting for password and thus not working quarry_06 Linux - Networking 2 12-14-2005 03:17 PM
Backup through SSH without password not working Maarten_Holland Linux - Networking 2 05-26-2005 04:56 AM
ssh/scp without password not working Mauline Linux - Security 4 03-30-2005 09:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration