Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Shells Virtual Desktop
BMail.ag - Secure Email Service
Server.net
CPLicense.net
VPS Server
Buy VPN
Vultr
VMs for AI
HostDare
HostDare
ReliableSite White-Label Dedicated Hosting for Resellers
25% Recurring Discount on NVMe VPS
InterServer VPS
BMail.ag - Secure Email Service
Best VPN
High-Performance Bare Metal Server Solutions
Karvl.com
Server Mania Cloud Hosting
DataWagon Hosting
AlphaVPS Hosting
Evoxt.com
Clouvider
VPS Hosting with NVMe
Residential IPs in the US & 4G Mobile Proxies in EU & US with Unlimited Bandwidth
ReliableSite White-Label Dedicated Hosting for Resellers
Rabisu - Hosting Solutions
Shells Virtual Desktop
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

setfacl command

If we need to set advanced/particular permission to a folder or a set of folders other than normal folder permission of 755 for directories , we can use access control lists (ACL)

We can use below bash script to set the particular permission for a set of folders

===

dir='dir1,dir2,dir3'

for d in $dir
do
( cd $d && setfacl -m d:o:rwx folder/ )
done

==

First we need to assign the folder names in the variable dir.

setfacl -m d:0:rwx folder/

This command will modify the permission of others category to rwx for the directory folder/ in all directories of the variable dir.

If you experience any error like

operation not supported/permitted

tune2fs -o +acl /dev/sda1(the disk/partition where those directories belong)

the above command will include acl option in the filesystem for that particular partition.

then remount it

mount -a

-------------------------------------##############---------------------------

Comments

  • mkshmksh Member

    Uh, well, OK? So setfacl actually sets ACLs right?

  • @mksh said:
    Uh, well, OK? So setfacl actually sets ACLs right?

    setfacl is usually used to set ACL's on a file if the target filesystem supports extended attributes. Most modern Linux filesystems supports xattrs nowadays, so you can easily take the OP's example and set the ACL's that way.

    Usually a remount with attrs option would enable extended attributes, but that works too by running tune2fs...

  • jsgjsg Member, Resident Benchmarker

    I particularly like the mount -afor remounting.

    (Correct: mount -o remount [mount point])

    Thanked by 2bootstrap mksh
Sign In or Register to comment.