What is setfacl command and it uses?

0
23

The setfacl command is used to set file access control list. This setfacl utility sets ACL’s of files and directories. Access control list allows giving permission for any user or group. For file systems, it will provide additional flexible permissions. Each file and directory in a Linux filesystem are created with a specific set of file permissions for its access. Each user can have a different set of file access permissions. The permissions can be set by using a setfacl utility.

Syntax:

Find the below syntax to set file access control lists

setfacl [-bkndRLPvh] [{-m|-x} acl_spec] [{-M|-X} acl_file] file ...
setfacl -restore=file

Explanation:

The setfacl utility sets an ACLs of directories and files. On the command line, a sequence of commands is followed by a sequence of files.

The options -m and -x expect an Access Control Lists on the command line. Multiple ACL entries are separated by commas (“,”). The options -M and -X read an ACL from a file or in a standard input. The ACL entry format is described in the ACL Entries section.

The -set and -set-file options set the ACL of a file or a directory. The previous ACL is replaced. ACL entries for this operation must include permissions.

The -m (-modify) and -M (-modify-file) options modify the ACL of a file or directory. ACL entries for this operation must include permissions.

The -x (-remove) and -X (-remove-file) options remove ACL entries. It is not an error to remove an entry which does not exist. Only ACL entries without the perms field are accepted as parameters unless the POSIXLY_CORRECT environment variable is defined.

LEAVE A REPLY

Please enter your comment!
Please enter your name here