1856608 Members
18102 Online
104113 Solutions
New Discussion

gid incorrect as user

 
Ronelle van Niekerk
Regular Advisor

gid incorrect as user

I did a terrible thing last week and overwrote the passwd file.
I struggled to get it restored and finally ended up doing a lot of editing and praying.

Non of the users have complained .... yet, but one of the dbas says that a user they use does not have the correct gid. But if I do an id on the user as root it comes up correct.

user$ id
uid=5017(user) gid=400(usergroup) groups=1000(dba),422(othergrp),192(othergrp2)

root# id user
uid=5017(user) gid=1000(dba) groups=400(usergroup),422(othergrp),192(othergrp2)

The passwd file entry states that 1000 (dba) is the user's group.

I've done a pwck on the passwd file and all it seems to be fine.
I've done a grpck on the group file and it seems fine too.
And yes, logingroup is linked to group.

What have I done?
What do I do?

rm -r /it/managers
8 REPLIES 8
Sundar_7
Honored Contributor

Re: gid incorrect as user

Hi,

Can u post

# grep user /etc/passwd /etc/groups

I know this might sound stupid but check for newgrp command in the user profile
Learn What to do ,How to do and more importantly When to do ?
Ronelle van Niekerk
Regular Advisor

Re: gid incorrect as user

# grep user /etc/passwd /etc/group
/etc/passwd:user::5017:1000:user:/home/dirs/user:/bin/sh
/etc/group:usergroup::400:user
/etc/group:dba::1000:oracle,user
/etc/group:othergrp::422:user
/etc/group:othergrp2::192:user


No newgrp command in the user profile.
rm -r /it/managers
Steven E. Protter
Exalted Contributor

Re: gid incorrect as user

run these utils

pwck

grpck

They will help you validate your errors.

Might I suggest regular fbackups and ignite backups.

Attaching the ignite script.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Vitek Pepas
Valued Contributor

Re: gid incorrect as user

Check the user's profile for 'newgrp' entries.
The newgrp command changes your group ID without changing your user ID and replaces your current shell with a new one.
Ronelle van Niekerk
Regular Advisor

Re: gid incorrect as user

As mentioned in original question, I did run the pwck and grpck commands - they both seem fine.

As mentioned in my previous reply, there is no newgrp command in the user's profile.

We do ignite backups once a month, should I try restore the passwd file from there rather than from the OBII backups?
rm -r /it/managers
Zigor Buruaga
Esteemed Contributor

Re: gid incorrect as user

Hi,

Try to create a new user, i.e "user2" with the same groups that "user". What happens? If the new user2 has the correct gid, check again "passwd" and "group" files and look for a clue.
Try also to remove "user" from the "groups" file, in the line "/etc/group:dba::1000:oracle,user"
Only an idea.

Hope this helps.
Kind regards,
Zigor
Ronelle van Niekerk
Regular Advisor

Re: gid incorrect as user

I think I solved the problem.

The users are added automatically and a passwd file is pushed out to my server when a new user is added. We're using something called KEON.

So I don't seem to have any control over my passwd file - thankfully I don't have to say the same about the group file.

I just got the guys who administer the KEON system to push a new passwd file to my server and everything seems to be OK.

I'm still not sure how it works because root seems to read the passwd file in /etc (as you can see from the id user output) but when you su into the user it doesn't read the right data.
I'll have to look into it some more
rm -r /it/managers
T G Manikandan
Honored Contributor

Re: gid incorrect as user

Yes,the best way would be not to guess on the password options.

Backup your current passwd file
#cp /etc/passwd /etc/passwd.
Just insert your ignite tape
#cd /tmp
#mt -f /dev/rmt/0mn rewind
#mt -f /dev/rmt/0mn fsf 1
#tar tvf /dev/rmt/0m passwd
#tar xvf /dev/rmt/0 passwd


"Make sure you have atleast one session with root logged in" for
Any password problems with the old file.