You are on page 1of 2

ACL (Access Control List):

How to List out default file system has applied ACL:


tune2fs l /dev/sda1 | grep l user_xattr

Steps for apply ACL on new file system.

Step 1: create file system using fdisk l


Step 2 : create folder mkdir /acldir
Step 3 : mkfs t ext4 /dev/sda5
Step 4 : mount o acl /dev/sda5 /acldir
Vi /etc/fstab
/dev/sda5 /acldir ext4 defaults,acl 0 0
Reboot the server
The below command for apply acl on file
Setfacl m u:user:rwx /acldir/file2
Options : u : User
G : group
X : remove the acl permisons
The below command for list out the acl list
Getfacl /acldir/file2

The below command is for remove acl permission for user or group
Setfacl x u:user /acldir/file2
Setfacl x g:group /acldir/file2

Steps for apply ACL on existed file system:


Mount o remount,acl /dev/sda5
Or
Mount o remount,acl /acldir
Vi /etc/fstab
/dev/sda5 /data ext4 defaults,acl 0 0
Add acl with defaults permissions.
Mount all
The below command for check acl applied or not

Questions & Answers:

1. How to change the umask value for file and folder?


Ans : if want to apply only for individual user then add below line in /root/.bash_profile or
/home/Prasad/.bash_profile

umask 0007 #File permission

umask 0006 #directory permission

Or if want to apply for server all users, then enter same above line in /etc/profile.

2. How we can apply the acl on folder level?

Ans: Use below command we can set the acl on folder level.

# Setfacl R m u:user:rwx /root/testdir/

3. How to remove the ACL permission on file?

Ans : setfacl x u:user /root/testdir/

4. How to take the acl permission backup?

Ans : getfacl -R --skip-base / > /backup.acl

5. How to list out the acl permission list?

Ans: getfacl /root/testdir

6. How to find the Inode number of file or dir?

Ans : ls i /root/testfile or stat /root/testfile

7. How to know the full info about file?

Ans : stat /root/testfile

You might also like