If you want to collaborate on a project and share files, for example, you’ll need to be in the same group with the other people on the team. Your first step is to find out which group you’re in, as shown in Code Listing 5.3.
[ejr@hobbes permissions]$ grep ejr → /etc/passwd ejr:aag2.UyC7yJKJWE:500:500:Eric J. Ray:/home/ejr:/bin/bash [ejr@hobbes permissions]$ |
1. | grep yourid /etc/passwd Here, grep yourid pulls your userid out of the /etc/passwd file (which is where user information is stored) and displays it as shown in Code Listing 5.3. From left to right, you see
| |
2. | Note the number of the group. You’ll need the number to match it up with a group name in step 3. In this case, our group id is 500. | |
3. | more /etc/group Here, we’re exploring the contents of the /etc/group file using more to see which groups are currently defined on the system. As shown in Code Listing 5.4, the first column contains the name of the group, the third contains the group number, and the last column contains extra names the system administrator added to the group. Users can belong to multiple additional groups, and this is how the additional group membership is indicated. Code Listing 5.4. The group file lists groups and additional members (as shown in the users group).
| |
4. | Match up the group number for your ID with the group name. Our number was 500, which corresponds to the ejr group name here. |
✓ Tips
If you’re collaborating on a project, ask your system administrator to create a special group just for the project. That way, you and your teammates can easily share files.
You can also use the groups or id commands, which offer a quicker way of finding out about group membership. These give you essential details about group membership (and userids, too), but they don’t flood you with these other most interesting and potentially useful details about the system. Wander to Chapter 7 for more information.
Check out Chapter 1 for more on more.
See Chapter 6 for the full scoop on grep.