UPDATE – I’ve found a much better fix – Use NFS shares instead- Use NFS shares instead of Samba with XBMC
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 ![]()
UPDATE – I’ve found a much better fix – Use NFS shares instead- Use NFS shares instead of Samba with XBMC
I believe the problem is the inability to completely turn off smb file sharing in Lion, when migrating files from Snow Leopard:
https://discussions.apple.com/thread/3211072?start=0&tstart=0
followed all the steps successfully.
but I am getting “connection refused” from my XBMC machine trying to access the newly configured Lion SMB server.
I also used the user:password combination which I configured using smbpasswd -a shell command… no avail – still connection refused..
what’s wrong?
Hi
I’m stuck at ‘sudo cd /opt/mports’
This command is not working.
I am getting “connection refused” error on my XBMC machine when I try to access my smb3@lion server.
I did add the matching user/password configure on the XBMC to the smb server using smbpasswd -a user, and then typing the matching password.
all the installation procedure went smoothly and I made sure the smbd process is running… help?
I cannot get this to stick. Every reboot I have to run the command from the terminal window: sudo /opt/local/sbin/smbd -D && sudo /opt/local/sbin/nmbd -D
I have added the plist (renamed for my Mac Mini) and added it to this folder: /Library/LaunchAgents and then I moved it to this folder: /Library/LaunchDaemons
Any suggestions or ideas?
Thanks – WwTIPPYwW
getting these messages too – producing console respawning messages every 10 seconds…
Aug 11 09:16:57 WwTIPPYwW-Mac-mini com.apple.launchd.peruser.501[175] (com.Mac-Mini.samba3launcher[11362]): Exited with code: 1
Aug 11 09:16:57 WwTIPPYwW-Mac-mini com.apple.launchd.peruser.501[175] (com.Mac-Mini.samba3launcher): Throttling respawn: Will start in 10 seconds
I think you also need to perform a
/opt/local/bin/smbpasswd -an nobody
Otherwise guest account nobody will not work.
Pingback: Hur du streamar material från din Mac med OS X Lion till XBMC på AppleTV 2G (Guide) - iPhonepyssel
Hi
I have followed your guide, SAMBA is running.
sources.smb.conf has been modiied with the code below.
[MOVIES]
path = “/Volumes/Macintosh HD 2/MOVIES”
available = yes
guest ok = yes
create mask = 644
directory mask = 755
read only = no
Workgroup and server name have also been set.
My Media Player sees the iMac but that is as far as it goes. Nothing can be accessed. BTW the Media player still goes straight in to a shared folder on my Hacbook (10.6.8) without blinking an eye.
Thank you for any suggestions.
Hi there,
i concurr with Pierre Scerri,,
i have SMB running i can connect with the imac.. see the shared folders.. but no acces..
login name and pasw fault.. on the lion machine..
how ever with 10.6.8 machine.. it is working flawless..
thanks any one with suggestions..
It worked! But you need to tell people to add a user and to enable the user if shares are not public (and I do not recommend public shares).
root# /opt/local/bin/smbpasswd -a usernam
New SMB password:
Retype new SMB password:
Added user username.
root# /opt/local/bin/smbpasswd -e username
User enabled
any idea how I can remove all of this (or if I even should) if I decided not to use it? It didn’t fix my specific problem.
Thank you So much for these awesome instructions. Apple TV is working perfectly now with XBMC and Samba3.
Can I uninstall Xcode now? It is taking up so much disc space and If I don’t need it any more I would rather get red of it to reclaim that disc space.
Thank you again. I was so upset that I had upgraded to Lion because it broke my XBMC and Apple TV. But Now I am Up and Running. Finally.
Cheers.
Hi,
First thank you very much for this post. I have managed to install samba3 and modify the smb.conf file but when I am running the last command “sudo /opt/local/sbin/smbd -D && sudo /opt/local/sbin/nmbd -D” it does not start the server because when I type “smbclient -L GG-SAMBA3″ I get Connection to GG-SAMBA3 failed (Error NT_STATUS_BAD_NETWORK_NAME).
The “testparm” run gives the following, global network is WORKGROUP.
testparm smb.conf
Load smb config files from smb.conf
Processing section “[homes]”
Processing section “[printers]”
Processing section “[Downloads]”
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
[global]
server string = GG-SAMBA3
log file = /usr/local/samba/var/log.%m
max log size = 50
dns proxy = No
[homes]
comment = Home Directories
read only = No
browseable = No
[printers]
comment = All Printers
path = /usr/spool/samba
printable = Yes
browseable = No
[Downloads]
comment = Downloads
path = /Users/Jerome/Downloads
read only = No
create mask = 0644
guest ok = Yes
It does not throw any error message, any idea how I can check what is going wrong ?
Cheers,
Jerome
Set user type as “share”, and it should work. Also, you don’t need to use sudo for CD commands. Just do CD “PATH” without the SUDO.
Have you set these options in the smb.conf?
security = share
guest account = nobody
After that my A.C Ryan Player could connect two the smb share without pw.
Hi
Okay! I got it to work. Just one thing – I have to turn Samba on from the terminal every time I boot. The plist is not working.
Thank you so much. After weeks of searching for a solution i finally have my smb shares working again.
Great guide! Not for everyone I guess but managed to get it working pretty easy!
Perhaps something to mention, if you install Macports with the package installer it also works, and saves some time and makes the procedure somewhat easier.
Anyway, happy to be streaming files to my media player again !
Does anyone know if I could uninstall Xcode after I setup Samba3? It’s 7GB and I plan on moving to an SSD soon and that’s way too much space for something I wouldn’t use except for this. Thanks in advance!
If anyone has problems here:
sudo cd /opt/mports
or here:
file:///opt/mports/trunk/dports
You need to point to ~/User/opt, your home folder not your root folder…
Thank you! Great post! Now Samba working better, than new AFP protocol in nightly XBMC.
Thanks for the quick guide
In my case i had a problem, that’s related with an bug (very old) on macports for samba 3.0.3 (https://trac.macports.org/ticket/30951), it seems when a user is in more than 16 groups, samba was unable to get the group list and fails the authentication check, with the following error:
2011/09/29 22:15:18, 0] lib/system_smbd.c:getgroups_unix_user(171)
get_user_groups: failed to get the unix group list
[2011/09/29 22:15:18, 0] auth/auth_sam.c:check_sam_security(355)
check_sam_security: make_server_info_sam() failed with ‘NT_STATUS_NO_SUCH_USER’
Creating another user seem to solve the problem.
Has anyone tried to make an installable samba package from macports? The installation of Xcode is a major hurdle for mostly everyone and it doesn’t serve any practical purpose for most.
I can’t install macports due to the version of Xcode I’m running, but this should work:
http://guide.macports.org/#using.binaries.binary-packages
People would still need to create the config files but at least the burden of work, compiling the binary, would be taken care of.
Worked perfectly. XMBC is working perfectly again. Thank You!
I have an error message after the configure command, you can help me
sudo cd /opt/mports/trunk/base OK
sudo ./configure –enable-readline Not OK
sudo: ./configure: command not found
Thank u for this guide! It was really great!!!
I had few problem with “permission denied”
I solved all my problems keeping really clear the smb.config:
[global]
workgroup = WORKGROUP
server string = “mac name”
[share folder]
….(follow the above instruction)…
After spending a whole day at this i still cannot get it to work.
I have followed the instructions to the letter and tried all the options posted above.
still will not work. I guess i cannot get SMB to work with Lion.
How do i uninstall all that i have added above.
Thanks! With this article and the add info in the comments about adding a user/password I was able to get access to my Mac from my Kindle Fire to view videos.
I have succesfully installed Samba on Lion. Thank you for your post.
In my case, I don’t have need enter a user or password. I want to say that trying to configure the Samba Shares in XBMC by the (Windows network) option or by scratch doesn’t worked for me. It didn’t find my smb server. I used the Zeroconf and It worked. I selected the computer, the shared directory and It put automatically the url but ADDING A PORT 445. Maybe It use a different port than the default. It works!
After hours and hours on the phone to Mac support, they suggested this linkm to get my OSX Lion MBP and iMac to work with my SMB NAS drive again.
Unfortunately, after following the above and receiving no errors, I still get the “server unsupported” message when trying to connect to my NAS (through finder).
Has anyone got any suggestions that I could try other than reinstalling back to Snow Leopard?!
I too would appreciate some instructions on how to uninstall the above
Would anyone be willing to post some files that we could download for reference? I need SMB to work but afraid this is all a bit over my head.
Pingback: Apple replaced Samba with SMBX « Scratch Pad
Like Jerome, I installed the Samba3 server but get the “bad network name error”, when I check the availibility of my Samba-Server.
So when I enter this into Terminal:
rob:/ rob$ smbclient -L rob1
It just says:
Connection to rob1 failed (Error NT_STATUS_BAD_NETWORK_NAME)
This is what testparm says:
rob:/ rob$ testparm
Load smb config files from /opt/local/etc/samba3//smb.conf
Processing section “[homes]”
Processing section “[Downloads]”
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
[global]
server string = rob1
log file = /usr/local/samba/var/log.%m
max log size = 50
printcap name = lpstat
dns proxy = No
hosts allow = 192.168.1., 192.168.2., 127.
[homes]
comment = Home Directories
read only = No
[Downloads]
comment = Downloads
path = /Users/rob/Downloads
valid users = rob
read only = No
create mask = 0644
guest ok = Yes
It doesn’t show up in testparm, but I also set up “security = user” and “guest account = nobody”. I also set up a Samba User called “rob” and enabled it.
What am I doing wrong? I have no clue, the firewall is also off … I will appreciate every hint.
Regards
rob
it’s important to note that when you are done installing and you have built your config that you need to create a local username for samba and you need to do that with your user account on your mac in my example jlloyd but it needs to be a different password then your normal workstation password example foobar. It will work after that.
Also forget the launch thing it never works so run
sudo /opt/local/sbin/smbd -D && sudo /opt/local/sbin/nmbd -D
password
enter
Hi There,
If you are like me you probably depended on Samba “SMB” to allow your Popcorn Hour to communicate to your Mac in order to stream your content. If you are reading this message your content is no longer working.
I made 2 short youtube videos for you to watch and get your content back online and working again.
Take some time and watch the video and post any questions you may have.
Part 1 http://youtu.be/O9RvZrCrg1Y
Part 2 http://youtu.be/9FOfeQdMqUY
Watch in Full Screen With 1080p Full Screen if you are having issues with see the font or terminal
Links and info you need
http://www.macports.org/install.php (Mac Ports Lion)
http://itunes.apple.com/us/app/xcode/id448457090?mt=12 (X Code)
Install Notes And Locations
sudo port -d sync
sudo port install samba3
sudo mv /opt/local/etc/samba3/smb.sample.conf /opt/local/etc/samba3/smb.conf
sudo vi /opt/local/etc/samba3
# workgroup = NT-Domain-Name or Workgroup-Name, eg: MIDEARTH
workgroup = WORKGROUP
# server string is the equivalent of the NT Description field
server string = maggot
# Security mode. Defines in which mode Samba will operate. Possible
# values are share, user, server, domain and ads. Most people will want
# user level security. See the Samba-HOWTO-Collection for details.
security = user
[Storage]
comment = Storage
path = /Volumes/Storage
available = yes
guest ok = yes
create mask = 644
directory mask = 755
read only = no
cd ~
vi samba.sh
i
sudo /opt/local/sbin/smbd -D && sudo /opt/local/sbin/nmbd -D
:wq!
chmod 755 samba
./samba
sudo killall smbd (This will restart/kill the samba process)
Pingback: Problemes amb el Samba del Lion | Friki Attack
Hi, would be very great full for some help as I got as far as: “sudo port -d sync”
and got this…..
Warning: /opt/local/etc/macports/sources.conf specifies invalid source ‘rsync:file:///opt/mports/trunk/dports [default]‘, ignored.
Warning: No default port source specified in /opt/local/etc/macports/sources.conf, using last source as default
can’t read “sources”: no such variable
while executing
“lindex $sources end”
(procedure “mportinit” line 171)
invoked from within
“mportinit ui_options global_options global_variations”
Error: /opt/local/bin/port: Failed to initialize MacPorts, can’t read “sources”: no such variable
As mentioned to John over twitter, I’ve built a free tool to install, uninstall and manage Samba on OS X Lion. It’s called SMBUp and can be found in MacUpdate (I won’t link to it on John’s blog out of deference, I don’t want to look like a spammer
).
I’m putting this comment here because this post is probably *THE* most linked post on Samba for Lion on the Internet. It sure is the one I used as a reference myself to give to dozens of friends until I decided to take it one step further and make it a fully-fledged tool and installer
(you can see where I was planning to do so on my comment from October above).
Also: To uninstall the macports packages mentioned above you can just run the “port” command with the “uninstall” option:
sudo port uninstall –follow-dependencies samba3
You can delete Xcode by deleting the /Developer folder in your hard drive’s disk (although I wouldn’t recommend either, if you don’t know what you’re doing).
I’m getting an error when launching the nmbd:
bind failed on port 137 socket_addr = 0.0.0.0.
Error = Address already in use
Any help on finding which process is using this?
it does not work for me on 10.7.3 and gives exceptionkeynotfound
when in installed the software it kept on installing samba but never completes, then i had to install it from the image
Works for me good on lion 10.7.3. Little problems with first time connect. Iam using samba for over years so i debug it and it works now.
Problems i saw.
Create smbpasswd -a “macusernaam”. De macusernaam must also exist in passed, so use the same as your system credentials.
set in [global] security=user, this means that username/password is requirement by login.
test your config with command “testparms smb.conf”. This will check if you configured something wrong.
test you config with de built-in smbclient. smbclient -L netbiosname -U macusername.
username is only requirement when use security=user, and you create a existing user thats in passwd and smbpasswd. When netbiosname don’t work, use the IP of the servers. If you get connected your server is working. Maybe you can’t browse the folders on your sharen.
When i connect to dune i connect directly to the folder and it works for me.
name: “name how to display”
Type: SMB
Server: “IP of your SMB server, properly your macbook”
Map: “Shared folder you connect to”
User: “User thats in smbpasswd”
Password: “user password”
Only what not work for me was the automatic start while boot.
thx for de work instruction
Pingback: New/Noob XBMC - iCulture forum | iPhone, iPad, iPod touch, Apple TV en iOS