• 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. ansible-inventory – Display or dump an Ansible inventory (Command Examples)
  2. ac: command not found
  3. git instaweb: Helper to launch a GitWeb server
  4. gdebi Command Examples in Linux
  5. CentOS / RHEL : How to convert volume group metadata between LVM1 and LVM2
  6. What are Symbolic Links (Soft Links) and how to create them under Linux
  7. how to rotate Tang Server Keys and update the Clevis Client
  8. arping: Discover and probe hosts in a network using the ARP protocol (Command Examples)
  9. db_load command – generate db database
  10. What is the refid in ntpq -p output?

You May Also Like

Primary Sidebar

Recent Posts

  • “glab repo” Command Examples
  • “glab release” Command Examples
  • “glab pipeline” Command Examples
  • “glab mr” Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright