1848100 Members
6893 Online
104022 Solutions
New Discussion

Re: /etc/group changing

 

/etc/group changing

Well, I have a weird problem, wich I can't really explain.

My /etc/group files is changing... alone... At first, I though I was the one making mistake. But we had a running unix system wich was working very fine, and then , boom.. Acces denied on some files. After checking why, the user was out of the group.. again!

Could it be that some of our admins uses vi to edit the group file, and some of them are using sam? I can't think why this would bothers but...

Anyone ever heard of an incompatibility between vi and sam?

Thanks
5 REPLIES 5
James R. Ferguson
Acclaimed Contributor

Re: /etc/group changing

HI:

Well, simply using 'vi' to change a file begins by making an in-memory copy of the file. When you finally write the in-memory contents, you overwrite whatever is on disk --- changed or not. There is no locking provided. Running 'vipw' does provide some safeguards for editting '/etc/passwd' but that variation of the command is specifically for that file.

Regards!

...JRF...
Jeff_Traigle
Honored Contributor

Re: /etc/group changing

No incompatibility that I'm aware of. Of course, I haven't ever used SAM to modify /etc/group. One possibility though... some admin might have a "golden" copy of the group file (or maybe using some CVS software) to maintain the file. When another admin edits the group file directly, the next update from the "golden" copy would overwrite that change.
--
Jeff Traigle
Paul Sperry
Honored Contributor

Re: /etc/group changing

You could look at the users /home/username/.sh_history file.
Or if there are a large amount of users just grep out"group" to get an idea who may be changing it

Re: /etc/group changing

I think I found it.. It it normal behavior of the usermod -G command to remove all other group?

Like the example i just tested
_____________-
[root /etc/] id chiami
uid=203(chiami) gid=103(dti) groups=4(adm),112(eti),117(pea)

[root /etc/] usermod -G chiami nic

[root /etc/] id chiami
uid=203(chiami) gid=103(dti) groups=117(pea)

___________

It removed all my other groups. Is this normal behavior?

Thanks
Jeff_Traigle
Honored Contributor

Re: /etc/group changing

That makes sense. -G redefines the supplemental group memberships, per the man page, so any change would need to be a complete list of the supplemental groups, not just the new one you want to add. There wouldn't be a way to remove a supplemental group membership with the existing options if it didn't behave this way.
--
Jeff Traigle