In Linux, after changing a user's group memberships, those group changes don't always take effect immediately within their current session without logging out. This can lead to issues with permissions and access to resources. This page explains using the 'sg' and 'newgrp' commands to refresh a user's group membership in Linux without a complete logout and login. See https://www.cyberciti.biz/faq/linux-refresh-reload-group-membership-without-logging-reboot/ for all examples. #linux #sysadmin #devops
Conversation
Notices
-
nixCraft 🐧 (nixcraft@mastodon.social)'s status on Friday, 16-Feb-2024 18:23:38 JST nixCraft 🐧 -
nixCraft 🐧 (nixcraft@mastodon.social)'s status on Friday, 16-Feb-2024 20:05:12 JST nixCraft 🐧 @mparienti The preferred command to use on Linux is the 'getent' command. However, the 'grep' command and the '/etc/group' file are also available on Linux and Unix variants and are quite simple. Sometimes, 'getent' may not be available, such as on a small embedded Linux router or an older Unix variant. This can be a problem when writing cross-site scripting. I hope this helps!
-
Michaël Parienti (mparienti@piaille.fr)'s status on Friday, 16-Feb-2024 20:05:13 JST Michaël Parienti Thanks again for your great article.
I have a question: I believed that using `getent passwd` and `getent group` were better practices than reading directly the files from `/etc/` directory.
But I noticed in your article you were using the files from `/etc` directory.
Do you have any advice about which way is better between the two approaches?
-