- Joined
- Mar 6, 2014
- Messages
- 9,553
Note: the following applies to FreeNAS 9.X.
I'm testing various ways of managing ACLs without using Windows "File Explorer". This is mainly for the benefit of users who don't have a windows computer available to initially set up CIFS permissions. As I test, I will update this post accordingly.
At this point, I believe the best way to manage ACLs on samba shares (apart from Windows File Explorer) is "smbcacls". smbcacls is a pretty good CLI equivalent of the security tab in explorer, and it appears for the most part to set ACLs that windows likes. It operates through SMB as opposed to setfacl (which has to be run locally on the UNIX system). The commands can therefore also be used to configure ACLs on a real windows server.
smbcacls
At present, smbcacls lacks the ability the recursively set permissions through a file tree. If you don't have a windows PC available to configure permissions when setting up your CIFS shares, you can use smbcacls to add the required access control entries prior to copying data.
Add an Access Control Entry with "Full Control"
The above command will add an ACE for the user "TestUser", grant full control and apply to the existing folder and all subdirectories.
"Flags" pertain to inheritance. "3" is probably what you want here. The value can be either represented in hex or decimal, not all values between 0-15 are valid.
Valid values for "permissions" include "READ", "CHANGE", "FULL".
View Existing Access Control Entries
View Existing Access Control Entries in Numeric (SID) Format
You can view the manpage for smbcacls here: https://www.samba.org/samba/docs/man/manpages/smbcacls.1.html
At present it appears that smbacls does not have a "recursive" switch. This limits its usefulness. For the past few years Noel Power has been working on adding inheritance propagation to smbacls. I believe this contains the latest work on it. See discussion here: http://marc.info/?l=samba&m=138675848923962&w=2
and here: http://marc.info/?l=samba-technical&m=138376145406579&w=2
I believe there are scaling issues (performance isn't great) when resetting permissions on tons of files. In these situations, it's probably best to use a windows client (unless you feel like compiling Noel Powers version of smbcacls with the built in http://cgit.freedesktop.org/~noelp/noelp-samba/log/?h=smbcacls_review#4).
I'm testing various ways of managing ACLs without using Windows "File Explorer". This is mainly for the benefit of users who don't have a windows computer available to initially set up CIFS permissions. As I test, I will update this post accordingly.
At this point, I believe the best way to manage ACLs on samba shares (apart from Windows File Explorer) is "smbcacls". smbcacls is a pretty good CLI equivalent of the security tab in explorer, and it appears for the most part to set ACLs that windows likes. It operates through SMB as opposed to setfacl (which has to be run locally on the UNIX system). The commands can therefore also be used to configure ACLs on a real windows server.
smbcacls
At present, smbcacls lacks the ability the recursively set permissions through a file tree. If you don't have a windows PC available to configure permissions when setting up your CIFS shares, you can use smbcacls to add the required access control entries prior to copying data.
Add an Access Control Entry with "Full Control"
Code:
smbcacls //<ip-address>/<share name> / -U <user name> --add ACL:<user>:type:flags/permissions smbcacls //192.168.24.42/TestShare / -U root --add ACL:TestUser:ALLOWED/3/FULL
The above command will add an ACE for the user "TestUser", grant full control and apply to the existing folder and all subdirectories.
"Flags" pertain to inheritance. "3" is probably what you want here. The value can be either represented in hex or decimal, not all values between 0-15 are valid.
Valid values for "permissions" include "READ", "CHANGE", "FULL".
View Existing Access Control Entries
Code:
smbcacls //<ip-address>/<share name> / -U <user name> smbcacls //192.168.24.42/TestShare / -U root
View Existing Access Control Entries in Numeric (SID) Format
Code:
smbcacls //<ip-address>/<share name> / -U <user name> --numeric smbcacls //192.168.24.42/TestShare / -U root --numeric
You can view the manpage for smbcacls here: https://www.samba.org/samba/docs/man/manpages/smbcacls.1.html
At present it appears that smbacls does not have a "recursive" switch. This limits its usefulness. For the past few years Noel Power has been working on adding inheritance propagation to smbacls. I believe this contains the latest work on it. See discussion here: http://marc.info/?l=samba&m=138675848923962&w=2
and here: http://marc.info/?l=samba-technical&m=138376145406579&w=2
I believe there are scaling issues (performance isn't great) when resetting permissions on tons of files. In these situations, it's probably best to use a windows client (unless you feel like compiling Noel Powers version of smbcacls with the built in http://cgit.freedesktop.org/~noelp/noelp-samba/log/?h=smbcacls_review#4).
Last edited: