sixtyfootersdude
sixtyfootersdude

Reputation: 27221

Unix Permisions: How do groups work in Unix

This is probably a dup (but did not find it..)

When you type ls -l in unix you get output like this:

% ls -l
total 48
-rwxr--r--   ... change*
-rwxrwxrwx   ... checkVersion*
-rwx------   ... info*

I know that the first group of rwx sets the users permisions and the last group sets "everyone else's" permisions. I think that the second rwx group sets the "group"s permissions.

How can I tell people who are in the group? What group am I in? Can I create new groups? Where are the groups defined on my machine?


Edit: Can I modify groups by modifying the /etc/groups file or do I need to do it with a command?

Upvotes: 4

Views: 1240

Answers (4)

Cicatrice
Cicatrice

Reputation: 211

You can edit group in /etc/group but it's really better to use system commands like :

  • groupadd to create some groups
  • usermod to operate on user and especially add users to group

Here is a sample that append yoda user to jedi group :

  • usermod -A jedi yoda

see the manual of each command for usage :

  • man groupadd
  • man usermod

Upvotes: 2

Federico klez Culloca
Federico klez Culloca

Reputation: 27119

To know which groups you are in type

groups

on the console.

The groups members are listed in /etc/group

Upvotes: 1

Fred
Fred

Reputation: 8602

The groups are defined in the /etc/group file. You'll find a listing of the groups and the accounts that are members of each group there.

The unix groups command tells you what groups your account is in.

Hubble:~ $ groups
staff _developer _lpoperator _lpadmin admin localaccounts everyone

Upvotes: 1

David Fox
David Fox

Reputation: 10753

check out the /etc/passwd file. it has your users. then check out the /etc/group file. it has the groups with unique id's

group-name:x:group-number:user1,user2

Upvotes: 0

Related Questions