Linux command
smbcacls 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Display ACLs
smbcacls //[server]/[share] [path/to/file] --user [domain\\username]%[password]
Set
smbcacls //[server]/[share] [path/to/file] --user [username]%[password] "ACL:[DACL]"
Reset
smbcacls //[server]/[share] [path/to/file] --user [username]%[password] "RESET" "ACL:[DACL]"
Change owner
smbcacls //[server]/[share] [path/to/file] --chown [domain\\user] --user [username]
Recursive
smbcacls //[server]/[share] [path/to/dir] --recurse --user [username]
说明
smbcacls manipulates Windows NT Access Control Lists (ACLs) on SMB/CIFS file shares. It allows viewing, modifying, and managing file permissions on remote Windows or Samba shares from the Linux command line. An ACL consists of Access Control Entries (ACEs) that define permissions for specific users or groups. The tool supports standard Windows permission operations including ownership changes and inheritance management.
参数
- -a, --add _acl_
- Add ACE entries without modifying existing ones
- -M, --modify _acl_
- Modify permission masks for specified ACEs
- -D, --delete _acl_
- Delete specified ACE entries
- -S, --set _acl_
- Replace entire ACL with new entries
- -C, --chown _name_
- Change file/directory owner
- -G, --chgrp _name_
- Change group ownership
- -I, --inherit _allow|remove|copy_
- Enable, remove, or copy inherited permissions
- --recurse
- Apply operations recursively to directories
- --numeric
- Display ACLs in numeric format
- --sddl
- Use SDDL format for input/output
- --save _file_
- Save DACLs to file for later restoration
- --restore _file_
- Restore DACLs from saved file
- -U, --user _username_
- SMB username (format: user%password or domain\\user%password)
- -W, --workgroup _domain_
- Set SMB workgroup/domain
- -d, --debuglevel _level_
- Debug verbosity (0-10)
FAQ
What is the smbcacls command used for?
smbcacls manipulates Windows NT Access Control Lists (ACLs) on SMB/CIFS file shares. It allows viewing, modifying, and managing file permissions on remote Windows or Samba shares from the Linux command line. An ACL consists of Access Control Entries (ACEs) that define permissions for specific users or groups. The tool supports standard Windows permission operations including ownership changes and inheritance management.
How do I run a basic smbcacls example?
Run `smbcacls //[server]/[share] [path/to/file] --user [domain\\username]%[password]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -a, --add _acl_ do in smbcacls?
Add ACE entries without modifying existing ones