getfacl - Unix, Linux Command

getfacl [-dRLPvh] file ...


getfacl [-dRLPvh] -




If getfacl is used on a file system that does not support ACLs, getfacl
displays the access permissions defined by the traditional file mode permission
bits.


The output format of getfacl is as follows:


 1:  # file: somedir/
 2:  # owner: lisa
 3:  # group: staff
 4:  user::rwx
 5:  user:joe:rwx               #effective:r-x
 6:  group::rwx                 #effective:r-x
 7:  group:cool:r-x
 8:  mask:r-x
 9:  other:r-x
10:  default:user::rwx
11:  default:user:joe:rwx       #effective:r-x
12:  default:group::r-x
13:  default:mask:r-x
14:  default:other:---





Lines 4, 6 and 9 correspond to the user, group and other fields of
the file mode permission bits. These three are called the base ACL
entries. Lines 5 and 7 are named user and named group entries. Line 8 is
the effective rights mask. This entry limits the effective rights granted
to all groups and to named users. (The file owner and others permissions
are not affected by the effective rights mask; all other entries are.)
Lines 10--14 display
the default ACL associated with this directory. Directories may
have a default ACL. Regular files never have a default ACL.


The default behavior for getfacl is to display both the ACL and the
default ACL, and to include an effective rights comment for lines
where the rights of the entry differ from the effective rights.


If output is to a terminal, the effective rights comment is aligned to
column 40. Otherwise, a single tab character separates the ACL entry
and the effective rights comment.


The ACL listings of multiple files are separated by blank lines.
The output of getfacl can also be used as input to setfacl.







ACL or Access Control List extends the basic file permissions of read, write and execute to more users and groups.
Consider two files ResumeSameer.txt and ResumeTara.txt. As of now both these have only basic permissions.
$ getfacl ResumeSameer.txt ResumeTara.txt
# file: ResumeSameer.txt
# owner: john
# group: humanresources
user::rw-
group::r--
other::r--

# file: ResumeTara.txt
# owner: john
# group: humanresources
user::rw-
group::r--
other::r--

We can add ACL to these files using setfacl. One of the files has been made accessible to user "joy" in read and write mode and to the group "engineering" in read mode.
$ setfacl -m u:joy:rw ResumeSameer.txt
$ setfacl -m g:engineering:r ResumeSameer.txt

Now the same command getfacl on the files gives below output
$ getfacl ResumeSameer.txt ResumeTara.txt
# file: test1.txt
# owner: john
# group: humanresources
user::rw-
user:joy:rw-
group::r--
group:engineering:r--
mask::rw-
other::r--

# file: test2.txt
# owner: john
# group: humanresources
user::rw-
group::r--
other::r--

Use of option --skip-base shows only those files where extended ACL has been defined.
$ getfacl --skip-base ResumeSameer.txt ResumeTara.txt
# file: test1.txt
# owner: john
# group: humanresources
user::rw-
user:joy:rw-
group::r--
group:engineering:r--
mask::rw-
other::r--

Use of option --omit-header removes first 3 lines of header for each file
$ getfacl --omit-header ResumeSameer.txt ResumeTara.txt
user::rw-
user:joy:rw-
group::r--
group:engineering:r--
mask::rw-
other::r--

user::rw-
group::r--
other::r--


    129 Lectures 
     23 hours 

 Eduonix Learning Solutions

    5 Lectures 
     4.5 hours 

 Frahaan Hussain

    35 Lectures 
     2 hours 

 Pradeep D

    41 Lectures 
     2.5 hours 

 Musab Zayadneh

    46 Lectures 
     4 hours 

 GUHARAJANM

    6 Lectures 
     4 hours 

 Uplatz
 Print
 Add Notes
 Bookmark this page