Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 5. Controlling Ownership & Permi... > Finding out which group you're in

Finding out which group you're in

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.

To find out which group you're in:

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:

  • Your userid

  • The encoded password

  • The number of your userid (each userid has a unique number in the system)

  • The number of your group (each group has a unique number in the system, too)

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 number 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 second 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.

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.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial