How to use ACL in Linux – TecAdmin https://tecadmin.net How to guide for System Administrator's and Developers Tue, 26 Apr 2022 06:25:12 +0000 en-US hourly 1 https://wordpress.org/?v=6.1.1 How to View or Change ACL in Linux Files https://tecadmin.net/how-to-use-acl-in-linux/ https://tecadmin.net/how-to-use-acl-in-linux/#respond Tue, 12 Mar 2013 14:57:02 +0000 https://tecadmin.net/?p=488 The Ext3 and Ext4 filesystem includes support of ACLs on files and directories. ACL provides more control permissions on file than standard three access categories (owner, group, and other ). Using ACL you can provide permission to a specific user or group to file. Before working on ACL make sure that ACL is enabled on [...]

The post How to View or Change ACL in Linux Files appeared first on TecAdmin.

]]>
The Ext3 and Ext4 filesystem includes support of ACLs on files and directories. ACL provides more control permissions on file than standard three access categories (owner, group, and other ). Using ACL you can provide permission to a specific user or group to file.

Before working on ACL make sure that ACL is enabled on the mounted file system. You can enable it during mounting the filesystem with the ACL option.

Use the following command Check if ACL is enabled on the filesystem or not.

sudo mount 
Output
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw,noatime,acl)

Enable ACL by remounting file system using following command.

# mount -o remount,acl  /

To enable ACL default on system bootup update following entry in /etc/fstab file.

Output
/dev/VolGroup00/LogVol00    /    ext3  defaults,acl  1 1

Configure ACL on File

If we want that user Bob to have all permissions on a file. Use the following command.

# setfacl -m u:Bob:rwx tecadmin.txt

Details of parameters:

setfacel:  is a command itself
 -m : is used to modify ACL.
  u : it denotes to assign permission to a user
bob : a system user
rwx : file permissions.
tecadmin.txt: file on which bob will get access.

Check ACL on File

Use following command to check ACL configured on a file.

# getfacl tecadmin.txt

Output:

# file: tecadmin.txt
# owner: root
# group: root
user::rw-
user:Bob:rwx
group::r--
mask::rwx
other::r--

Remove ACL from File

If we don’t need the ACL in file, we can simply remove using following command.

# setfacl -x u:Bob tecadmin.txt

The post How to View or Change ACL in Linux Files appeared first on TecAdmin.

]]>
https://tecadmin.net/how-to-use-acl-in-linux/feed/ 0