Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

This is on a CentOS 5.3 server

I am logged in as myUser.
myUser is added to a new group while logged in. (root edits the /etc/group file in another session)
How can I get the change to take effect without logging out and logging back in?

Bill

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Have the user run:

exec su $USER

Or:

exec sudo -u $USER -s

That will replace their login shell with a new login shell that's been freshly logged in as them. su will definitely prompt them for their password. sudo might not, but I believe will require configuring /etc/sudoers so the user has permission to run a shell as themselves. If you leave out the "exec", the user will have to "exit" twice.

On Unix, when you login there's a period where there's software running as root that's authenticated the user, which then sets up the groups before switching to running a shell as that user. After that, there's no way to change the permissions without involving software run as root again.

share|improve this answer

This is pretty much impossible because the login session reads at the beginning the group file. If you initiate a new login session you might be able to do it but i think it is not possible.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.