Aqui está um script que eu uso para reparar um compartilhamento específico no meu servidor todos os dias às 2h.
Script de reparo (salvo em / Usuários / Compartilhado / Scripts)
#!/bin/bash
# Document Control
# ---------------
# Filename: repair_FileShare.sh
# Description: Repairs ownership and permissions on all files in the file share
# Version: 1.0
# Local Variables
# ---------------
SharePath=/path/to/shared/folder/
# Repair Routine
# ---------------
# Unlock all files
chflags -R nouchg $SharePath
# Remove all ACL permissions
chmod -RN $SharePath
# Set Ownership - OwnerName:GroupName (Example MrSmith:FinanceTeam)
chown -R root:admin $SharePath
# Set Posix Permissions - Check out http://permissions-calculator.org for more on what 770 means
chmod -R 770 $SharePath
# Add ACL for Active Directory Group
chmod -R +a "DOMAINNAME\AD_Group_Name allow list,add_file,search,delete,add_subdirectory,delete_child,readattr,writeattr,readextattr,writeextattr,readsecurity,writesecurity,chown,file_inherit,directory_inherit" $SharePath
Launch daemon usado para executar o script todos os dias às 2h
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.yourdomain.repair_FileShare</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>/Users/Shared/Scripts/repair_FileShare.sh</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>02</integer>
<key>Minute</key>
<integer>00</integer>
</dict>
</dict>
</plist>
Salve como /Library/LaunchDaemons/com.yourdomain.repair_FileShare.plist Em seguida, use esses comandos para carregá-lo:
sudo chown root:wheel /Library/LaunchDaemons/com.yourdomain.repair_FileShare.plist;
sudo chmod 600 /Library/LaunchDaemons/com.yourdomain.repair_FileShare.plist;
sudo launchctl load -w /Library/LaunchDaemons/com.yourdomain.repair_FileShare.plist;