Mac OS X Lion and Mountain Lion: fix the Samba (SMB) sharing issue

Introduction

Since I own my Mac running Mountain Lion, I wanted to use it to share video and audio content with my XBMC multimedia server over the local network. It's very easy to set up (System preferences &gt Sharing), but unfortunately it is very unstable to say the less. In fact, most of the times it simply doesn't work.
I noticed that deactivating and re-activating the share temporary fixes the issue. But that doesn't last long, since when the computer restarts it won't work anymore.
I called the Apple support about this, thinking I probably did something wrong. But without success. They weren't able to help, and nobody seemed to know about that kind of issue at the time. Long after that I read that this was a known issue due to a crappy implementation of Samba by Apple in Lion and Mountain Lion. So I gave up on sharing my files with computer running Windows or with my Raspbmc. Until recently, I found this post on a blog for which I thank the author a lot.
It's bascially about setting up a 60 seconds timer when Mac OS starts, before rebooting the Samba server. Samba's first boot failed due to dependencies that weren't yet ready. This simple timer ensures all dependencies are well started before booting Samba correctly.
These instructions not being self-explanatory for novices to the Terminal, here is how to proceed, step by step and easily.

Step 1: Create a plist file

Open the TextEdit application, then click on "New document".
Convert to text format:
My system is in French, but you get the idea
Paste the below text inside the document:

<?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.me.restart_smb</string>
  <key>ProgramArguments</key>
  <array>
  <string>/bin/bash</string>
  <string>-c</string>
  <string>sleep 60;touch "/Library/Preferences/SystemConfiguration/com.apple.smb.server.plist"</string>
  </array>
  <key>RunAtLoad</key>
  <true/>
</dict>
</plist>


Once done, save the file as follows:
- Location: Desktop
- Name: com.me.restart_smb.plist
- Uncheck box "Use .txt as default extension"
My system is in French, but you get the idea

Step 2: Move the file to the right folder

Move the file  com.me.restart_smb.plist from the desktop to Macintosh HD > Library > LaunchDaemons:


The system will ask you for the admin password. Enter it, then validate.

Step 3: Change access rights on the file

Select file com.me.restart_smb.plist, then go to File > Read information.
Ensure the access rights are read/write for the system and the admin user, and read only for everyone else:

Alright, you're done. Now your Samba shares will work even if you reboot your computer. If this solved your issue, you can thank the author of this blog from which I took the solution, and on which I just added additional explanations.
Posting Komentar (0)
Lebih baru Lebih lama