Create samba launchers plists
/Library/LaunchDaemons/com.samba.smbd.plist
:
<?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.samba.smbd</string >
<key >ProgramArguments</key >
<array >
<string >/opt/samba/sbin/smbd</string >
<string >--foreground</string >
<string >--no-process-group</string >
<string >-s</string >
<string >/opt/samba/etc/smb.conf</string >
</array >
<key >RunAtLoad</key >
<true />
<key >KeepAlive</key >
<dict >
<key >SuccessfulExit</key >
<false />
<key >Crashed</key >
<true />
</dict >
</dict >
</plist >
/Library/LaunchDaemons/com.samba.nmbd.plist
:
<?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.samba.nmbd</string >
<key >ProgramArguments</key >
<array >
<string >/opt/samba/sbin/nmbd</string >
<string >-F</string >
<string >--no-process-group</string >
</array >
<key >KeepAlive</key >
<false />
<key >RunAtLoad</key >
<true />
</dict >
</plist >
sudo mkdir /var/log/samba/
Optionally disable native NETBIOS service:
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.netbiosd.plist
see additional info here
Create basic samba config file:
# /opt/samba/etc/smb.conf
[global]
workgroup = WORKGROUP
netbios name = server
debug hires timestamp = No
debug timestamp = yes
idmap cache time = 604800
ldap ssl = start tls
log file = /var/log/samba/%m.log
log level = 1
max log size = 10000
passdb backend = tdbsam://etc/passdb.tdb
[SHARE_NAME]
path = /Volumes/DISK_NAME
public = yes
browsable = yes
writable = yes
directory mask = 0755
create mask = 0644
guest ok = no
Add samba directory to the PATH variable:
export PATH=/opt/samba/bin:/opt/samba/sbin:$PATH
Setup username and password for samba share:
sudo smbpasswd -a <username>
sudo launchctl bootstrap system/ /Library/LaunchDaemons/com.samba.smbd.plist
sudo launchctl bootstrap system/ /Library/LaunchDaemons/com.samba.nmbd.plist
sudo launchctl list | grep samba
launchctl print system/com.samba.smbd | grep "state"