LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Clarification for output of id command (https://www.linuxquestions.org/questions/linux-newbie-8/clarification-for-output-of-id-command-4175703087/)

kazesyxers 11-04-2021 12:51 PM

Clarification for output of id command
 
Hello people,

I'm trying to understand id command used to display details about users. When i simply type id i got below result
uid=1000(kaze) gid=1000(kaze) groups=1000(kaze),27(sudo)

But when using command id kaze, i got below output
uid=1000(kaze) gid=1000(kaze) groups=1000(kaze),27(sudo),33(www-data)

Please note that i previously did below command and i a connected as kaze user
sudo usermod -a -G www-data kaze

Can somebody, please explain why i do not have the same result with both id commands, knowing that i am connected with kaze user?

Turbocapitalist 11-04-2021 01:03 PM

The changes to group membership only take effect after you've logged in anew. So my guess is that id by itself is not reading from /etc/group but instead from the current login session and that you've made the change but not logged out and back in again, at least in the one window.

By the way, there's usually no reason for any normal account to be a member of the group www-data. That group exists only to accompany the account www-data. That account exists only for the purpose of providing a separate, unprivileged account for the web daemon to run under. That is for the purposes of both Privilege Separation and Least Privilege. So, short of extenuating circumstances, you should remove your account from that group. What problem were you trying to solve?

kazesyxers 11-04-2021 01:15 PM

Thank you so much for your feedback. I logged out and logged in again and i now have the same output to both commands!

I was no trying to solve a special problem, just playing around to understand user and group management on my box.

Thank you again!


All times are GMT -5. The time now is 09:46 AM.