How do I find out what groups I belong to under Linux operating systems?
/etc/group is a text file which defines the groups on the system. You can use the groups command to display group memberships for any user using the following syntax.
groups groups userName-Here
pen a command-line terminal (select Applications > Accessories > Terminal), and then type:
vivek cdrom floppy audio dip video plugdev netdev bluetooth scanner
You are part of all of the above groups. To find group memebership for root user, enter:
$ groups root
root : root
Please note that (from the groups man page):
Primary and supplementary groups for a process are normally inherited from its parent and are usually unchanged since login. This means that if you change the group database after logging in, groups will not reflect your changes within your existing login session. Running `groups' with a list of users causes the user and group database to be consulted afresh, and so will give a different result.
You can also use the id command as follows to get the same information:
$ id -Gn
$ id -Gn userName
$ id -Gn vivek
How Do I Find Out My Primary Group Membership?
Type the following command:
$ getent group userName
$ getent group vivek
In this example, user vivek has group id # 1000 and has group name vivek for primary group membership.
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012
- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop