1.8. Setting permissions on a share that uses POSIX ACLs
Optionally, to limit or grant access to a Samba share, you can set certain parameters in the share’s section in the /etc/samba/smb.conf file.
Share-based permissions manage if a user, group, or host is able to access a share. These settings do not affect file system ACLs.
Use share-based settings to restrict access to shares, for example, to deny access from specific hosts.
1.8.1. Prerequisites 링크 복사링크가 클립보드에 복사되었습니다!
- A share with POSIX ACLs has been set up.
1.8.2. Configuring user and group-based share access 링크 복사링크가 클립보드에 복사되었습니다!
User and group-based access control enables you to grant or deny access to a share for certain users and groups. For more inforation, see the smb.conf(5) man page on your system.
Prerequisites
- The Samba share on which you want to set user or group-based access exists.
Procedure
For example, to enable all members of the
Domain Usersgroup to access a share while access is denied for theuseraccount, add the following parameters to the share’s configuration:valid users = +DOMAIN\"Domain Users" invalid users = DOMAIN\userThe
invalid usersparameter has a higher priority than thevalid usersparameter. For example, if theuseraccount is a member of theDomain Usersgroup, access is denied to this account when you use the previous example.Reload the Samba configuration:
# smbcontrol all reload-config
1.8.3. Configuring host-based share access 링크 복사링크가 클립보드에 복사되었습니다!
Host-based access control enables you to grant or deny access to a share based on client’s host names, IP addresses, or IP range. For more information, see the smb.conf(5) man page on your system.
The following procedure explains how to enable the 127.0.0.1 IP address, the 192.0.2.0/24 IP range, and the client1.example.com host to access a share, and additionally deny access for the client2.example.com host:
Prerequisites
- The Samba share on which you want to set host-based access exists.
Procedure
Add the following parameters to the configuration of the share in the
/etc/samba/smb.conffile:hosts allow = 127.0.0.1 192.0.2.0/24 client1.example.com hosts deny = client2.example.comThe
hosts denyparameter has a higher priority thanhosts allow. For example, ifclient1.example.comresolves to an IP address that is listed in thehosts allowparameter, access for this host is denied.Reload the Samba configuration:
# smbcontrol all reload-config