Install samba on OSX Lion

This is compiled from many sources and works with me.

 

  1. Install MacPorts (and XCode 4.1 before), there is a dmg for Lion at http://www.macports.org/install.php
  2. in Terminal > sudo port -d sync
  3. in Terminal > sudo port install samba3 I had to do it twice to go right
  4. in Terminal > sudo cp /opt/local/etc/samba3/smb.conf.sample \
    /opt/local/etc/samba3/smb.conf
    to copy the sample-config-file
  5. I like nano, that’s why I put in Terminal > sudo nano /opt/local/etc/samba3/smb.conf
    Now you have to edit your shares:
  6. [global]
    	workgroup = WORKGROUP
    	server string = myServer 

    [Music]
    	comment = Music
    	path = /Users/theUser/Music
    	available = yes
    	guest ok = yes
    	create mask = 644
    	directory mask = 755
    	read only = no 

    In nano to save press ^-X and y and enter the path which is given

  7. in Terminal > sudo nano /Library/LaunchDaemons/org.samba.smbd.plist and paste the follow text in it:
  8. <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//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>OnDemand</key>
    		<false/>
    		<key>ProgramArguments</key>
    		<array>
    			<string>/opt/local/sbin/smbd</string>
    			<string>-F</string>
    		</array>
    		<key>RunAtLoad</key>
    		<true/>
    		<key>ServiceDescription</key>
    		<string>samba</string>
    	</dict>
    </plist>
  9. in Terminal > sudo nano /Library/LaunchDaemons/org.samba.nmbd.plist and paste the follow text in it:
  10. <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//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>OnDemand</key>
    		<false/>
    		<key>ProgramArguments</key>
    		<array>
    			<string>/opt/local/sbin/nmbd</string>
    			<string>-F</string>
    		</array>
    		<key>RunAtLoad</key>
    		<true/>
    		<key>ServiceDescription</key>
    		<string>netbios</string>
    	</dict>
    </plist>
  11. disable in System Preferences – Sharing – Options: SMB
  12. disable netbiosd-Daemon:
    sudo launchctl stop com.apple.netbiosd
    sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.netbiosd.plist
  13. start samba:
    sudo launchctl load /Library/LaunchDaemons/org.samba.smbd.plist
    sudo launchctl load /Library/LaunchDaemons/org.samba.nmbd.plist

Sometimes there is the need of a user and a password, for this type in terminal
>sudo smbpasswd -a <username>
You have to put in your password and that’s it!
To uninstall samba or macports see MacPort Guide

I found out, it is better to give the Server another name, not the sharing name in the Pref Panel

Posted Saturday, September 10th, 2011 under OsX.

Tags:

2 comments

  1. Nice job, thanks for share.

  2. allergy says:

    great

    this helps me a lot

Leave a Reply