1.9. Setting up a share that uses Windows ACLs
Samba supports setting Windows ACLs on shares and file system object.
This feature enables you to:
- Use the fine-granular Windows ACLs
- Manage share permissions and file system ACLs using Windows
Alternatively, you can configure a share to use POSIX ACLs. For details, see Setting up a Samba file share that uses POSIX ACLs.
Parts of this section were adopted from the Setting up a Share Using Windows ACLs documentation published in the Samba Wiki. License: CC BY 4.0. Authors and contributors: See the history tab on the Wiki page.
1.9.1. Granting the SeDiskOperatorPrivilege privilege 复制链接链接已复制到粘贴板!
Only users and groups having the SeDiskOperatorPrivilege privilege granted can configure permissions on shares that use Windows ACLs.
Procedure
For example, to grant the
SeDiskOperatorPrivilegeprivilege to theDOMAIN\Domain Adminsgroup:# net rpc rights grant "DOMAIN\Domain Admins" SeDiskOperatorPrivilege -U "DOMAIN\administrator" Enter DOMAIN\administrator's password: Successfully granted rights.注意In a domain environment, grant
SeDiskOperatorPrivilegeto a domain group. This enables you to centrally manage the privilege by updating a user’s group membership.To list all users and groups having
SeDiskOperatorPrivilegegranted:# net rpc rights list privileges SeDiskOperatorPrivilege -U "DOMAIN\administrator" Enter administrator's password: SeDiskOperatorPrivilege: BUILTIN\Administrators DOMAIN\Domain Admins
1.9.2. Enabling Windows ACL support 复制链接链接已复制到粘贴板!
To configure shares that support Windows ACLs, you must enable this feature in Samba.
Prerequisites
- A user share is configured on the Samba server.
Procedure
To enable it globally for all shares, add the following settings to the
[global]section of the/etc/samba/smb.conffile:vfs objects = acl_xattr map acl inherit = yes store dos attributes = yesAlternatively, you can enable Windows ACL support for individual shares, by adding the same parameters to a share’s section instead.
Restart the
smbservice:# systemctl restart smb
1.9.3. Adding a share that uses Windows ACLs 复制链接链接已复制到粘贴板!
You can create a share named example that shares the content of the /srv/samba/example/ directory and uses Windows ACLs.
Procedure
Create the folder if it does not exist. For example:
# mkdir -p /srv/samba/example/If you run SELinux in
enforcingmode, set thesamba_share_tcontext on the directory:# semanage fcontext -a -t samba_share_t "/srv/samba/example(/.*)?" # restorecon -Rv /srv/samba/example/Add the example share to the
/etc/samba/smb.conffile. For example, to add the share write-enabled:[example] path = /srv/samba/example/ read only = no注意Regardless of the file system ACLs; if you do not set
read only = no, Samba shares the directory in read-only mode.If you have not enabled Windows ACL support in the
[global]section for all shares, add the following parameters to the[example]section to enable this feature for this share:vfs objects = acl_xattr map acl inherit = yes store dos attributes = yesVerify the
/etc/samba/smb.conffile:# testparmOpen the required ports and reload the firewall configuration using the
firewall-cmdutility:# firewall-cmd --permanent --add-service=samba # firewall-cmd --reloadRestart the
smbservice:# systemctl restart smb
To manage share permissions and file system ACLs on a Samba share that uses Windows ACLs, use a Windows applications, such as Computer Management. For details, see the Windows documentation. Alternatively, use the smbcacls utility to manage ACLs.
To modify the file system permissions from Windows, you must use an account that has the SeDiskOperatorPrivilege privilege granted.