Operating System - HP-UX
1823063 Members
3054 Online
109645 Solutions
New Discussion юеВ

Update /etc/passwd and not /etc/group

 
SOLVED
Go to solution
Aravind_3
Frequent Advisor

Update /etc/passwd and not /etc/group

This command,

useradd -m -g Johngroup -d /data/user1 -s /bin/false user1

is updating /etc/passwd and /etc/group file both.

how do i make this command to update only the /etc/passwd and not /etc/group file.

Thanks
Aravind
8 REPLIES 8
Christian Gebhardt
Honored Contributor

Re: Update /etc/passwd and not /etc/group

Hi
you cannot prevent the command to write in /etc/group file, but you can delete the new entry in the group-file manually.

useradd -m -g Johngroup -d /data/user1 -s /bin/false user1 | sed -e 's/user1//' -e 's/,$//' /etc/group > /etc/group.tmp; mv /etc/group.tmp /etc/group
U.SivaKumar_2
Honored Contributor

Re: Update /etc/passwd and not /etc/group

Hi,

Since you are using -g option the useradd command will update /etc/group , there is no
way to prevent other than omiting -g option

regards,
U.SivaKumar
Innovations are made when conventions are broken
Aravind_3
Frequent Advisor

Re: Update /etc/passwd and not /etc/group

hey! some catch here...!
useradd behaves differently in 10.20 and 11.00

It updates /etc/group in 10.20 and not in 11.00 !!!

Any patches.. any previously reported issues ?

Thanks
Aravind
U.SivaKumar_2
Honored Contributor

Re: Update /etc/passwd and not /etc/group

Hi,

follow this link

http://www.informatik.uni-frankfurt.de/RBI/hp-service/patches/s700_800/10.X/PHCO_18925.txt

regards,
U.SivaKumar

Innovations are made when conventions are broken
Jeff Schussele
Honored Contributor

Re: Update /etc/passwd and not /etc/group

On a trusted system, even if you omit the -g parm on the command line & there is no actual change made inside the /etc/group file, the system DOES touch the file & consequently updates the mod time of the file. Same thing occurs if the user is created with an existing group. No mod but it is touched.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Aravind_3
Frequent Advisor

Re: Update /etc/passwd and not /etc/group

I just installed the patch

PHCO_18925 s700_800 10.20 user/group(add/mod/del) Cumulative patch

But no help, the useradd is still behaving the same way.

Was that patch meant for this behaviour ?

Aravind
Jean-Luc Oudart
Honored Contributor

Re: Update /etc/passwd and not /etc/group

As far as I remember in 10.20 /etc/group is updated for primary group as for 11.0 you won't have an entry in /etc/group for your primary group.
primary group information is in /etc/passwd

Jean-Luc
fiat lux
Darrell Allen
Honored Contributor
Solution

Re: Update /etc/passwd and not /etc/group

I imagine useradd was modified with 11.x because of changes in how secondary groups are handled.

Basically, prior to 11.0 a user was only in one group at a time unless /etc/logingroup existed. Generally one would create logingroup as a symlink to /etc/group. With 11.x, /etc/logingroup is no longer needed.

Search the forums for logingroup. You'll find a number of threads including:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xaa27eea29889d611abdb0090277a778c,00.html

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)