Operating System - HP-UX
1845857 Members
4198 Online
110250 Solutions
New Discussion

Problem adding user via SAM

 
GARY L. JACKSON
Occasional Contributor

Problem adding user via SAM

Failed to add the user "username" to the group "groupname". Could not modify the /etc/group file. The user was added to the system.

The user is added to the system and is placed in the correct group, but I don't know why I'm getting this error message.

Server=rp7410
OS=HP-UX 11.11

Thanks for the help.
To Whomsoever much is given...much is required.
13 REPLIES 13
doug mielke
Respected Contributor

Re: Problem adding user via SAM

is /etc/group there? What are it's permissions? and, when do you get the error?

try to cp /etc/group to /etc/group.old, then modify /etc/group
G. Vrijhoeven
Honored Contributor

Re: Problem adding user via SAM

Hi,

If the group already exsisted there is no need to alter the /etc/group file. If so you now have an number in the homedir in stead of a name. You can try using vi to edit the group file.

Check the SAM log for more errors, you can use lsof ( if installed) to see witch process has the group file open.

Gideon
GARY L. JACKSON
Occasional Contributor

Re: Problem adding user via SAM

The permission for /etc/group is 444. I get the message after I create a new user and just after setting the initial password.
To Whomsoever much is given...much is required.
Todd McDaniel_1
Honored Contributor

Re: Problem adding user via SAM

I would check the fuser to see if something has the file open... OR check for any control characters in the file...

Also, I have a script that I use to add users to all my 11 boxes or a combo thereof... I will offer it freely for your modification...

I like to keep all my boxes in sync with the passwd files...

via remsh...



useradd -g $2 -d /home/${2}/${1} -s /usr/bin/ksh -m -c "${3}" $1
remsh HOSTNAME2 "/usr/sbin/useradd -g $2 -d /home/${2}/${1} -s /usr/bin/ksh -m -c \"${3}\" $1"
remsh HOSTNAME3 "/usr/sbin/useradd -g $2 -d /home/${2}/${1} -s /usr/bin/ksh -m -c \"${3}\" $1"
remsh HOSTNAME4 "/usr/sbin/useradd -g $2 -d /home/${2}/${1} -s /usr/bin/ksh -m -c \"${3}\" $1"
remsh hostNAME1 "/usr/sbin/useradd -g $2 -d /home/${2}/${1} -s /usr/bin/ksh -m -c \"${3}\" $1"
remsh hostNAME2 "/usr/sbin/useradd -g $2 -d /home/${2}/${1} -s /usr/bin/ksh -m -c \"${3}\" $1"
remsh hostNAME3 "/usr/sbin/useradd -g $2 -d /home/${2}/${1} -s /usr/bin/ksh -m -c \"${3}\" $1"
remsh hostNAME4 "/usr/sbin/useradd -g $2 -d /home/${2}/${1} -s /usr/bin/ksh -m -c \"${3}\" $1"
remsh hostNAME5 "/usr/sbin/useradd -g $2 -d /home/${2}/${1} -s /usr/bin/ksh -m -c \"${3}\" $1"
remsh hostNAME6 "/usr/sbin/useradd -g $2 -d /home/${2}/${1} -s /usr/bin/ksh -m -c \"${3}\" $1"
remsh HOSTname1 "/usr/sbin/useradd -g $2 -d /home/${2}/${1} -s /usr/bin/ksh -m -c \"${3}\" $1"
for name in hostNAME6 hostNAME5 hostNAME4 hostNAME3 hostNAME2 hostNAME1 HOSTNAME2 HOSTNAME3 HOSTNAME4 HOSTname1
do
echo $name
remsh $name tail -1 /etc/passwd
done
uname -n
tail -1 /etc/passwd
while true
do
echo "Which system do you want a login on?"
echo "1) hostNAME6 "
echo "2) hostNAME5 "
echo "3) hostNAME4 "
echo "4) hostNAME3 "
echo "5) hostNAME2 "
echo "6) hostNAME1 "
echo "7) HOSTNAME4 "
echo "8) HOSTNAME3 "
echo "9) HOSTNAME2 "
echo "10) HOSTNAME1 "
echo "11) HOSTname1 "
echo "12) exit"
read system_id
case $system_id in
1) remsh hostNAME6 "sed 's/${1}:\*/${1}:/' /etc/passwd > /tmp/passwd; mv /tmp/passwd /etc/passwd;chmod 444 /etc/passwd;";;
2) remsh hostNAME5 "sed 's/${1}:\*/${1}:/' /etc/passwd > /tmp/passwd; mv /tmp/passwd /etc/passwd;chmod 444 /etc/passwd;";;
3) remsh hostNAME4 "sed 's/${1}:\*/${1}:/' /etc/passwd > /tmp/passwd; mv /tmp/passwd /etc/passwd;chmod 444 /etc/passwd;";;
4) remsh hostNAME3 "sed 's/${1}:\*/${1}:/' /etc/passwd > /tmp/passwd; mv /tmp/passwd /etc/passwd;chmod 444 /etc/passwd;";;
5) remsh hostNAME2 "sed 's/${1}:\*/${1}:/' /etc/passwd > /tmp/passwd; mv /tmp/passwd /etc/passwd; chmod 444 /etc/passwd;";;
6) remsh hostNAME1 "sed 's/${1}:\*/${1}:/' /etc/passwd > /tmp/passwd; mv /tmp/passwd /etc/passwd; chmod 444 /etc/passwd;";;
7) remsh HOSTNAME4 "sed 's/${1}:\*/${1}:/' /etc/passwd > /tmp/passwd; mv /tmp/passwd /etc/passwd; chmod 444 /etc/passwd;";;
8) remsh HOSTNAME3 "sed 's/${1}:\*/${1}:/' /etc/passwd > /tmp/passwd; mv /tmp/passwd /etc/passwd; chmod 444 /etc/passwd;";;
9) remsh HOSTNAME2 "sed 's/${1}:\*/${1}:/' /etc/passwd > /tmp/passwd; mv /tmp/passwd /etc/passwd; chmod 444 /etc/passwd;";;
10) remsh HOSTNAME1 "sed 's/${1}:\*/${1}:/' /etc/passwd > /tmp/passwd; mv /tmp/passwd /etc/passwd; chmod 444 /etc/passwd;";;
11) remsh HOSTname1 "sed 's/${1}:\*/${1}:/' /etc/passwd > /tmp/passwd; mv /tmp/passwd /etc/passwd; chmod 444 /etc/passwd;";;
12) exit 1
esac
done
Unix, the other white meat.
Kevin Nikiforuk
Valued Contributor

Re: Problem adding user via SAM

Hi Gary,

If your /etc/group has permission 444, then
owner,group and other has read permission only, not allow to modify that file. Changed the permission to 744.
GARY L. JACKSON
Occasional Contributor

Re: Problem adding user via SAM

One thing I've notice is that I only get this message when I try to add a new user to one particular group. When I create a new user and add that person to a different group, everything works fine. Is there a maximum number of users allowed in a group? Thanks.
To Whomsoever much is given...much is required.
doug mielke
Respected Contributor

Re: Problem adding user via SAM

I checked 2 of my newly built 11.0 systems, and they have 444 as perms for both /etc/passwd and /etc/group.
doug mielke
Respected Contributor

Re: Problem adding user via SAM

/etc/group, 444 , bin bin
/etc/passwd 444 root sys
Ian Kidd_1
Trusted Contributor

Re: Problem adding user via SAM

Weird one. Possibly your /etc/group file is corrupt (maybe a hidden character or something). copy the file to a backup (`cp -p /etc/group /etc/group.old`), make sure your logged in as root, then run the grpck command. Maybe it will find an inconsistency that would explain your error
If at first you don't succeed, go to the ITRC
Hazem Mahmoud_3
Respected Contributor

Re: Problem adding user via SAM

I am assuming that the group already exists, correct? If it does not, create the group first. If it does exist, run grpck as well as pwck. This will check for inconsistencies between the group and password files. One other option, if you are not using that group for any users, try deleting it (groupdel) and recreating it. Maybe there is a conflict with another group id.

-Hazem
T G Manikandan
Honored Contributor

Re: Problem adding user via SAM

The best thing would be to run

#pwck
#grpck

to check the group and password files.

Bill Hassell
Honored Contributor

Re: Problem adding user via SAM

grpck and pwck are the first steps. Then look at the entries for the problem group name in /etc/group. If it is a massively long line, use vi to edit the file and break up the line into several lines, each with the same group ID. It is fine to have multiple lines with the same group ID. However, if this particular group is the same groupthat appears in the passwd file, it is no longer needed, only additional group memberships need top appear in /etc/group.


Bill Hassell, sysadmin
GARY L. JACKSON
Occasional Contributor

Re: Problem adding user via SAM

Finally called HP and they advise me to install Patch PHCO_28007. After installing this patch, the problem went away. Thank all for the responses.
To Whomsoever much is given...much is required.