OSX Lion Samba SMB shares broken – XBMC not working

Well it’s been a nightmare few days with the upgrade to Lion GM breaking Samba sharing. For me NFS isnt really an option, it’s clunky, and my network is full of old windows machines, not to mention the XBMC’s on the Apple TV 2, Ipad 2, iPhone and the old Xboxs. i needed a fix for Samba, and this came in the form of installing Samba 3 on Lion via Macports and setting up the smb.conf file manually to share my media.

This text is partly my own work and partly complied from other tutorials.

You will need a copy of Lion GM installed on your mac, along with a copy of xcode 4.1 (available from a lot of places, legitimate or otherwise). You will then also install first macports and then samba 3 via terminal, but most of this stuff is copy & paste. Finally, I’d install a copy of Textwrangler for mac. It will let you edit files in its text editor without using the command line, which is much easier, and will let you unlock & authenticate to save/open files anywhere in the filesystem.

First, install Xcode 4.1 (DP7 or GM is needed currently).
Second, install MacPorts from SVN using these directions taken from macports site

Check out MacPorts source
In Terminal, one line at a time

sudo mkdir -p /opt/mports
sudo cd /opt/mports
sudo svn checkout http://svn.macports.org/repository/macports/trunk

Build and Install MacPorts

MacPorts uses autoconf and makefiles for installation. These commands will build and install MacPorts to /opt/local. I ran all these with the sudo command before them to avoid permissions problems


sudo cd /opt/mports/trunk/base
sudo ./configure --enable-readline
sudo make
sudo make install
sudo make distclean

Open /opt/local/etc/macports/sources.conf in a text editor. The last line which should look like this:

rsync://rsync.macports.org/release/ports/

Change it to point to the working copy you checked out:

file:///opt/mports/trunk/dports

Now MacPorts will look for portfiles in the working copy.

After installing MacPorts, you may need to add it to your PATH, so go ahead and run in terminal:

export PATH=$PATH:/opt/local/bin

and then

sudo port -d sync

This will make sure that it is added to your path, and you shouldn’t have to specify full paths to binaries. The second command tells macports to download the latest versions of the portfiles (instructions for macports on installing a program)

Once everything with macports is finished setting up, open up a terminal window and type

sudo port install samba3

It’ll automatically install samba 3 and all of its dependencies.

Now to edit the configuration! It’s pretty straight forward if you read through the config file located at /opt/local/etc/samba3/smb.conf (it’s callend smb.conf.sample, just remove the .sample from the filename and open with textwrangler).

Your shares should look something like this (you can have as many as you like):

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

[Movies]
comment = Movies
path = /Volumes/MyBook/Movies
available = yes
guest ok = yes
create mask = 644
directory mask = 755
read only = no

[TV]
comment = TV
path = /Volumes/MyBook/TV Shows
available = yes
guest ok = yes
create mask = 644
directory mask = 755
read only = no

Also, remember to change your workgroup name to match the rest of the machines on your network, mine are all on workgroup so mine looks like

# workgroup = NT-Domain-Name or Workgroup-Name, eg: MIDEARTH
workgroup = WORKGROUP

And the name of my mac is imac so my server string is

# server string is the equivalent of the NT Description field
server string = imac
(that way SMB shares can be accessed at smb://imac instead of using IP based). You can leave the rest of the config file commented out.

All that’s left now is to do

sudo /opt/local/sbin/smbd -D && sudo /opt/local/sbin/nmbd -D

(I’m using full paths so we dont accidentally start up the apple supplied smb server ) and samba will be up and running. The only downside I’ve found is that you do need to remember to start samba every time you reboot (the “sudo /opt/local/sbin/smbd -D && sudo /opt/local/sbin/nmbd -D” commands).

You can use the following launchagent to start the samba server everytime your machine restarts.

Download mine here and put it in /Library/LaunchAgents, and it should automatically start up samba for you.

Now in XBMC just add your samba shares as follows.

smb://imac (or whatever your machine is called in the server string above)

NOTE: Please remember to turn off SMB sharing in settings>sharing>File Sharing as the built in OSX Lion SMB implementation will clash with the one you installed via Macports

If you found this post helpful why not help out my business and buy some geek badges from our site :)

2600 Digital Edition Downloads

I’ve finally started reading Digital Editions of 2600: The Hacker Quarterly. Historically I’ve been buying the magazine from their Yahoo store and having it mailed to me from the USA, but the kindle edition means I can have it on the day f release, and read it on the kindle or the iPad. Perfect. Also means I’m building up a great library of digital content with me at all times, ideal if I’m out & about and want to refer to an article.

Check it out

The Filter Bubble: What The Internet Is Hiding From You epub

I’m currently reading The Filter Bubble by Eli Pariser. I downloaded the book as a DRM free epub (I’m funny about where I buy my books from as I have a Kindle, an iPad & an iPhone so i tend to chop and change my reading device). I’m about 50% of the way through the book and it’s quite scary stuff. It’s so far prompted me to slim down my Facebook account, including removing extra information from the account. I’ve also taken steps to block tracking websites by disabling tracking in Firefox & ramping up my Adblock Pro. It’s really crazy how much money can be made from your information, you think you are benefiting from a great free service but the company behind it are normally profiting hugely from sharing your information.
It really is a great read, give it a look and grab a copy for your kindle or iPad.

iPad 2 is the future

After a month searching the length & breadth of Britain for a 3G iPad 2 I finally got hold of one in the Exeter apple store. It was a 150 mile round trip with no guarantees of bagging one but I did it. I’m now the proud owner of an iPad 2 64gb 3G model with an O2 microsim.

I’m really impressed so far. My only criticism of the iPad 2 is the quality of the cameras. They are adequate, but feel like an afterthought. The resolution is rubbish on both front & rear cameras and my ageing iPhone 3G takes much better stills.

With that in mind let’s look at the iPad 2 itself as a functional mobile device. I’m not entering into the post pc era nonsense. This device will never replace my iMac, but it will complement both the iMac & iPhone. Right now I’m writing this blog entry from my seat on the train somewhere between cornwall & london. my power adapter is buried deep inside my luggage, I won’t be needing it. I’ve got my headphones in, and my music library on shuffle & I’m multitasking between my business email, website backends and my twitter feed. It really is an amazing device and already has changed the way I can work.

I will put a full review up shortly. Now back to my work and onwards to london to support Gary @the marathon.

Western Digital WD My Book Essential 2TB Hard Drive – Nice

I finally took the plunge and bought a decent sized external hard drive. Up until now I’ve hoarded away my movies & media on DVD’s but with the cost of storage media plummeting I decided to opt for one of these 2TB hard drives from Western Digital. The My Book Essential is a nice looking unit with a gloss black finish, rubberised feet to stop vibration and a front facing storage gauge indicating how full the drive is. The drive is nice and fast over USB 2.0 and does a great job of spinning down when not in use and even shuts itself down when I put the mac to sleep so is very conveneient.

 

The drive itself is pretty silent, and apart from the odd click I never hear it operating.

Formatting for the mac was simple and Disk Utility did a full format in around 10 mins. My first impressions of the drive are positive. I’ve already copied a lot of my media back from DVD’s onto the drive and in my quest for a minimal digital footprint I’ve disposed of the disks.

I’ve now used a terabyte of space, but all my disks are now archived on the drive so It’s just free to fill with movies & TV shows now. Now that I’ve got XBMC installed on the apple TV I’m allowing it to scrape the drive for all my media and adding it to the library which is very convenient. True on demand media, complete with movie posters, series information, actors etc. Superb