31

I've a group on my system and I don't know which permission it has. Where can I find all group permissions?

I want to have an output like this:

folders owned by group 'test'

/home/test/Documents/    
/home/test/Pictures/    
/var/www/website/    
var/www/python/

5 Answers 5

49

You can see the rights of group by ls -l in terminal to see the permissions of corresponding files.

drwxrwxr-x   3 owner group    4096 Jun 23 17:15 Calibre Library
-rw-rw-r--.  1 owner group   44444 May 25 11:36 custom 1.tar.gz
drwxr-xr-x.  4 owner group    4096 Jul 11 21:26 Desktop
drwxr-xr-x.  2 owner group    4096 Jul  9 20:35 Documents
drwxr-xr-x. 13 owner group   12288 Jul 11 12:42 Downloads
drwx------.  7 owner group    4096 Jun 23 13:21 Dropbox

Which can be further shown

enter image description here

You can refer to File Permissions for changing permissions. Whereas following commands are used to change it.

chmod - modify file access rights
su - temporarily become the superuser
chown - change file ownership
chgrp - change a file's group owner

EDIT : To view the files owned by the group "test" and user "luser' use FIND command

to find all the groups available on your system:

cat /etc/group |cut -d: -f1

eg. for finding the groups that the current user belongs to

groups
luser test adm cdrom sudo dip plugdev lpadmin sambashare

then looking for groups luser belongs to

groups luser
luser : test luser adm cdrom sudo dip plugdev lpadmin sambashare

Now to see the files owned by group "test" in particular path or folder. Try

find /home -group test

find /etc -group root


GUI method via Nautilus , select the Group, Permissions , Owner options from the Nautilus Preferences menu.

enter image description here

Then in Nautilus File manager , by selecting Icons views you will get the group name under icon as

enter image description here

And in list view you will get something like

enter image description here

1
  • 2
    Thats not an answer on my question. See my edited post.
    – OrangeTux
    Jul 24, 2012 at 13:04
7

Groups don't have permissions so to say...

Each file/folder is owned by a user and a group. If your group owns the file/folder then you'll have the permissions in the second group of permissions.

For example, let's say a file has:

-rwxrw-r--

Split this into thirds, excluding the first character (this is a special character):

  • rwx (Owner) - The owner has read/write and execute permissions.

  • rw- (Group) - The group has read and write permissions.

  • r-- (Everyone else) - Everyone else has read permissions.

You can change these permissions using chmod and you can change who owns them by using chown. To learn more about these commands, open a terminal and type man chmod or man chown.

3
  • 1
    But how can I see which folders/files got owned by a certain group?
    – OrangeTux
    Jul 12, 2012 at 12:23
  • 1
    @ OrangeTux cd to directory and enter ls -al That will give a complete readout of permissions.
    – user76204
    Jul 18, 2012 at 16:53
  • 1
    Thats not an answer on my question. See my edited post.
    – OrangeTux
    Jul 24, 2012 at 13:04
4

You would type in the following command:

find / -group test 2>/dev/null

Syntax description:

find       = Find command
/          = from root Directory down
-group     = search for a group where ...
test       = ...group name equals 'test'
2          = Error Output ...
>          = ...is redirected...
/dev/null  = ...to device NULL (no Output)
3

Try:

find / -group name_of_group
1

To see the permissions of all files and folders associated with the group test in the mentioned folders you can use

find /home/test/Documents /home/test/Pictures /var/www/website var/www/python -group test -printf %M -print
  • -printf %M will output the permissions in the same form ls-l does, not followed by a newline
  • -print adds the filename followed by a newline.

Reference: man find.

To see the permissions of the mentioned folders you can use

ls -ld /home/test/Documents /home/test/Pictures /var/www/website var/www/python

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .