有没有办法通过Linux本身直接从Samba Share的文件和文件夹设置Windows ACL?
我知道有setfacl / getfacl选项,但它们只能在: – DENY |之间改变 READ-ONLY | 全控制 – 如果我有这个权利。
但是我需要一个Windows安全组修改权限。 而recursion到所有以下的目录。 如果我直接通过SMB连接从Windows更改,则由于大量的文件,这将需要数小时甚至数天。 有没有办法做到这一点,还是不可能? 我知道信息存储在共享的任何地方,因为我可以将Linux中的文件复制到共享文件夹,并自动获得以前select的修改权限。
为了避免通过SMB更改设置,我从共享中复制文件。 删除共享中的所有文件,并从共享上的窗口更改权限。
Actually this is how I proceeding so far: In Linux: 1. I copy files and folders from the share folder to a separate location. 2. I delete all stuff in the share folder. In Windows: 3. Then accessing the empty share folder through SMB. 4. From here I can change recursively the permissions for access groups to apply "modify" permissions. Back in Linux: 5. Now I can copy the files and folders back into the share folder to set the permissions.
– >文件通过复制过程获得新的权限。
如果你在运行Samba 4,命令samba-tool ntacl肯定可以做到。
不幸的是很难find关于如何使用这个命令设置ACL的详细文档:
#samba-tool ntacl set -h Usage: samba-tool ntacl set <acl> <file> [options] Set ACLs on a file. Options: -h, --help show this help message and exit --quiet Be quiet --xattr-backend=XATTR_BACKEND xattr backend type (native fs or tdb) --eadb-file=EADB_FILE Name of the tdb file where attributes are stored --use-ntvfs Set the ACLs directly to the TDB or xattr for use with the ntvfs file server --use-s3fs Set the ACLs for use with the default s3fs file server via the VFS layer --service=SERVICE Name of the smb.conf service to use when applying the ACLs Samba Common Options: -s FILE, --configfile=FILE Configuration file -d DEBUGLEVEL, --debuglevel=DEBUGLEVEL debug level --option=OPTION set smb.conf option from command line --realm=REALM set the realm name Credentials Options: --simple-bind-dn=DN DN to use for a simple bind --password=PASSWORD Password -U USERNAME, --username=USERNAME Username -W WORKGROUP, --workgroup=WORKGROUP Workgroup -N, --no-pass Don't ask for a password -k KERBEROS, --kerberos=KERBEROS Use Kerberos --ipaddress=IPADDRESS IP address of server -P, --machine-pass Use stored machine account password Version Options: -V, --version Display version number
我会build议你这个程序:
# 1) # In Windows # Go to one shared folder/file and change the permissions as desired #2) # In Linux # Get infos of the ACLs of the directory/file you just set up in SDDL format #samba-tool ntacl get --as-sddl /path/to/my/share O:LAG:BAD:P(A;OICI;0x001f01ff;;;BA)(A;OICI;0x001200a9;;;SO)(A;OICI;0x001f01ff;;;SY)(A;OICI;0x001200a9;;;AU) #3) # Use the SDDL parameter to change all the files you want with same ACL # samba-tool ntacl set "O:LAG:BAD:P(A;OICI;0x001f01ff;;;BA)(A;OICI;0x001200a9;;;SO)(A;OICI;0x001f01ff;;;SY)(A;OICI;0x001200a9;;;AU)" /path/to/other/files
详情:
samba-tool ntacl get --as-sddl [file/directory]
将以SDDL格式获取ACL信息。 更多关于SDDL的信息
samba-tool ntacl set "[SDDL string]" [file/directory]
将在文件/文件夹上应用指定的ACL
解决scheme并不完美,它可以帮助你。
关于samba-tool命令: https : //www.samba.org/samba/docs/man/manpages-3/samba-tool.8.html
有关Samba邮件列表的相关问题: https : //lists.samba.org/archive/samba-technical/2011-October/079820.html