[Hampshire] sshd command execution oddity

Top Page

Reply to this message
Author: Damian Brasher
Date:  
To: hampshire@lists lug org uk
Subject: [Hampshire] sshd command execution oddity
Hi

Andy, bad luck re: ssh post:-/ Perhaps RHEL6 has been tightened up or perhaps I have found a bug. Before I go any further I wonder if anyone here might know more. I'm working with sshd and executing commands using Perl-Net-SSH-Perl and one of these commands is useradd. Now, for every other distribution I have tested there have been no problems, but sending this to a RHEL6 box...        


my $ADD_USER_A="/usr/sbin/useradd -g users -G sshd -d ${dir_a}"
."${user_acc} -m -p ${crypt_user_pass} ${user_acc}";

..over ssh as root. The command fails, but succeeds if logged in to a terminal as root.

/var/log/secure

Jan 26 21:16:58 localhost sshd[1345]: Accepted password for root from 192.168.2.13 port 45729 ssh2
Jan 26 21:16:58 localhost sshd[1345]: pam_unix(sshd:session): session opened for user root by (uid=0)
Jan 26 21:16:58 localhost useradd[1365]: new user: name=testuser, UID=500, GID=100, home=/test/testuser, shell=/bin/bash
Jan 26 21:16:58 localhost useradd[1365]: add 'testuser' to group 'sshd'
Jan 26 21:16:58 localhost useradd[1365]: add 'testuser' to shadow group 'sshd'
Jan 26 21:16:58 localhost useradd[1365]: failed adding user 'testuser', data deleted

I set SELinux as permissive and disabled it but this did not fix the issue, I suspected this would be the case as there are no SELinux messages in the logs.

I've been scouring the /etc/ssh/sshd_config man page for clues and even diff'ed the RHEL6 config file against the working (with) Fedora14 sshd_config file, there were no significant differences aside from explicitly defining Protocol 2. I'm thinking there may be a change in pam authentication handling or /etc/shadow changes.

TIA Damian

Interlinux Ltd - DIASER - Zentyal - Red Hat
http://www.interlinux.co.uk