• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

setfacl Command Examples in Linux

by Deepika

The setfacl command in Linux is used to set file access control lists (ACLs) on files and directories. ACLs provide a way to grant permissions to specific users and groups for accessing a file or directory, in addition to the traditional file permission system.

The traditional file permission system in Linux consists of three levels of access – read, write, and execute – which can be granted or denied for the owner of the file, the group, and all other users. ACLs provide a finer-grained level of access control by allowing you to set individual permissions for specific users and groups.

The setfacl command is used to set and modify ACLs for files and directories. The syntax of the setfacl command is as follows:

# setfacl [options] file

Here, file specifies the file or directory to which the ACL is to be applied.

setfacl Command Examples

1. Modify ACL of a file for user with read and write access:

# setfacl -m u:username:rw file

2. Modify default ACL of a file for all users:

# setfacl -d -m u::rw file

3. Remove ACL of a file for a user:

# setfacl -x u:username file

4. Remove all ACL entries of a file:

# setfacl -b file

For more information about the setfacl command, you can visit the man page by typing the following command in the terminal:

# man setfacl

This will display the manual page for the setfacl command, which provides detailed information about the command and its options.

Filed Under: Linux

Some more articles you might also be interested in …

  1. How to Delete unnecessary Entry in /etc/shadow
  2. cmatrix: Shows a scrolling Matrix like screen in the terminal
  3. steghide: command not found
  4. blkdiscard Command Examples in Linux
  5. “git remote” Command Examples
  6. TIME_WAIT queue troubles
  7. conntrack Command Examples in Linux
  8. jstack Command Examples
  9. john Command Examples
  10. rename Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright