Fixing SMB issues with OSX Lion

Update: THIS DOES NOT APPLY TO MOUNTAIN LION. The technique mentioned here does not work on Mountain Lion

I use a Linksys NAS200 as a file share device at home. This uses Samba – an open-source port of Microsoft’s SMB file share protocol – for sharing files to other computers. This worked fine from my Mac when I was using Snow Leopard.

At some point after I upgraded to Lion (not exactly sure when, but I don’t think it was on upgrade day…), I tried to access the share and could connect. It turns out that Apple have discontinued support for older versions of the SMB protocol (pre-Windows XP versions, to be precise). Of course, that’s the exact version used by my NAS.

I found lots of suggestions on line to fix this, but the simplest one is just to re-enable the support. Apple have only turned it off by default, and you can turn it back on. I used the instructions I found in an Apple support notice to turn it on temporarily, like so:

sudo sysctl -w net.smb.fs.kern_deprecatePreXPServers=0
And this let me connect to my file server. Yay!
Unfortunately, this is only temporary. The command changes  a setting in the kernel (the foundation layer of the operating system), but it’s transient – it will get forgotten the next time you start the computer. A little bit of googling later, and I found how to make it permanent.

You need to edit the file /etc/sysctl.conf – the file may not exist, but if it does you probably want to back it up first. Add the setting from above into the file.

My sysctl.conf file ended up looking like this – I added a couple of extra settings I found while searching for this that significantly speed up transferring files, so a win all around (or so it seems):

# Re-enable smb support for my old LinkSys NAS200
net.smb.fs.kern_deprecatePreXPServers=0
# Maybe make NAS faster?
net.inet.tcp.delayed_ack=0

(The tip about delayed_ack came from this post over at MacWorld.com. Reasonably fine to do on a home network, but probably not a good idea on a busy network)

If you found this useful, please let me know. 🙂