Using the Command "Id" in Linux?

I have some doubts with the use of the command id in Linux...

I have added one user(andre) to the group "github-total", do if I do id andre I got:

$ id andre
uid=500(andre) gid=500(andre) groups=500(andre),502(github-total) context=user_u:system_r:unconfined_t

But if I do only id:

$ id
uid=500(andre) gid=500(andre) groups=500(andre) context=user_u:system_r:unconfined_t

The thing is that the user "andre" is not assuming that he is in the group "github-total" when I run only id without argument. And in reality the user is not in the group.

So my question is... How can I add the user "andre" to the group "github-total"?

Best Regards,

Sorry my english.

1 Answer

The reason is that you made the change but haven't logged out / logged back in again.

When you run id with no arguments, it prints the data inherited from the parent shell, which established the group IDs after it consulted the databases after login.

When you run id with a username, it instantly queries the databases to see what that user's group id information is.

So... to directly answer your question, logout then log back in. :-)

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest