How To Check Which Groups A User Belongs To On Linux
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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
by Prakash Subramanian · Published : June 19, 2018 || Last Updated: June 19, 2018
Adding a user into existing group is one of the regular activity for Linux admin. This is daily activity for some of the administrator who’s working one big environments.
Even i am performing such a activity on daily in my environment due to business requirement. It’s one of the important command which helps you to identify existing groups on your environment.
Also these commands helps you to identify which groups a user belongs to. All the users are listed in /etc/passwd file and groups are listed in /etc/group.
Whatever command we use, that will fetch the information from these files. Also, each command has their unique feature which helps user to get the required information alone.
Some members may find this information redundant but there are LQ members who may need to be aware of this information.
Quote:
"Knowledge is of two kinds. We Know a subject ourselves, or we know where we can find information upon it."- Samuel Johnson
Please consider using the 'man command' to get familiar with a particular command & options.
Yeah, he's LQ's answer to Wikipedia.
I've only ever used id:
Code:
brian@slackdesk2:~$ id
uid=1000(brian) gid=100(users) groups=100(users),5(tty),7(lp),11(floppy),14(uucp),16(dialout),17(audio),18(video),19(cdrom),83(plugdev),84(power),86(netdev),93(scanner),999(vboxusers),1000(burning)
brianL, just trying to help fellow LQ members who may need some guidance to information to help with their Gnu/Linux experience.
Nice to see your back and posting style was missed.
Quote:
“Good manners is the art of making those people easy with whom we converse. Whoever makes the fewest persons uneasy, is the best bred in the company.”- Swift
brianL, just trying to help fellow LQ members who may need some guidance to information to help with their Gnu/Linux experience.
Yeah, you're doing a great job, Gary. Keep it up.
Quote:
Originally Posted by onebuck
Nice to see your back and posting style was missed.
Thanks. I tend to go off sulking & muttering bad things about political-correctness, lack of sense of humour, and one-track minds whenever I get a warning from moderators.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.