How to setup a file server on Mac OS X (mavericks) that actually works!

Everybody knows that since Apple was obligated to remove Samba’s codebase (www.samba.org) from their Mac OS X the file services become unusable for most of the users. This simple tutorial teaches how to setup a working file services on Mac OS X that works like a charm.

DISCLAIMER!!! These instructions assumes that you already are an experienced sysadmin, don’t ask stupid questions in public.

  • Remove the original file services daemon… (watch this on server upgrades)
$ sudo launchctl stop com.apple.netbiosd
$ sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.netbiosd.plist
  • Install homebrew (you don’t have to use sudo for this), check for errors on brew website (www.brew.sh)
$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)”
$ brew doctor
  • Install samba using the brew!
$ brew install samba
  • Now we have to launch these daemons on boot

Put these line below on the /Library/LaunchDaemons/org.samba.nmbd.plist file or from http://pastebin.com/eMY5NuTA

$ sudo vim /Library/LaunchDaemons/org.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>org.samba.nmbd</string>
 <key>ProgramArguments</key>
 <array>
 <string>/usr/local/sbin/nmbd</string>
 <string>-F</string>
 </array>
 <key>RunAtLoad</key>
 <true/>
 <key>ServiceDescription</key>
 <string>netbios</string> 
</dict>
</plist>

Put these on the /Library/LaunchDaemons/org.samba.smbd.plist file or from http://pastebin.com/2WMLwjkn

$ sudo vim /Library/LaunchDaemons/org.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>org.samba.smbd</string>
 <key>ProgramArguments</key>
 <array>
 <string>/usr/local/sbin/smbd</string>
 <string>-Fs</string>
 <string>/usr/local/etc/smb.conf</string>
 </array>
 <key>RunAtLoad</key>
 <true/>
 <key>ServiceDescription</key>
 <string>samba</string> 
</dict>
</plist>

Load the services…

$ sudo launchctl load /Library/LaunchDaemons/org.samba.smbd.plist
$ sudo launchctl load /Library/LaunchDaemons/org.samba.nmbd.plist
  • Edit your minimum smb.conf configuration.
$ vim /usr/local/etc/smb.conf

* if you do it properly there is no need to restart the services or use sudo vim to change the configurations… all are automatically loaded in running server.

Example configuration

[global]
 workgroup = HOME
 netbios name = SERVER
 security = SHARE
 log file = /usr/local/Cellar/samba/3.6.23/var/log.smbd
 log level = 2
[MyPublicShare]
comment = My Share Description
path = /Shared Items/Public
read only = no
guest ok = yes

* you probably want a better samba configuration, so do you own research at http://www.samba.org/ about how you can do it or hire my services in about section.😀

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s