How can I make bash recognise that some user has been added to a group?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Does anyone disagree that logging in is the key act to getting a newly added group recognized? It does not matter whether you want this group recognized w/in a tty, Xterm, Desktop Environment, or Window Manager -- you must log in after being added to a group in order to exercise that group's privileges.
No one knows if there is way to "reload" the /etc/group info. w/o logging out & logging back in. This is analogous to daemons, e.g. dnsmasq, that can be made to reload their config files w/o having to be shut down & restarted, let alone needing a full re-boot of the whole OS.
Although I included "tty, Xterm" in my summary for the sake of completeness, the real problem, at least for me, is w/ the GUI's, where logging out & back in is real problem: time consuming & the risks losing session info -- what web pages & what files are open in which work spaces -- that sort of thing, not to mention losing unsaved data.
We have discussed some relatively painless solutions for tty's & Xterm's. My favorite is "[sudo] su <current_user>". I believe it does not pass the current command history through; however, that can be cured by (a preceding) "history -w".
I don't use screen, so I have no idea what its problems w/ new groups might be. Given that it allows more complicated tty/Xterm sessions, this might be analogous to the GUI problem.
FWIW, I don't think that exporting $GROUPS will work, because it gets its info from /etc/group at log in.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.