Setup SAMBA on Ubuntu for XBMC shares

Like a lot of people I have a central computer which stores my pictures , videos etc, and have a home theater server with XBMC in the living room. To enable XBMC to display pictures and stream videos from your central computer you can use SAMBA. These instructions are for Ubuntu but apart from the actual SAMBA package install they should work for any Linux flavor.

Install SAMBA

On your server you want to share out the media from install SAMBA

sudo apt-get install samba

Create a nice easy directory structure

To make things easy for XBMC create a directory structure with symlinks to your media directories that can be shared out. e.g. within XMBC I want to have my media split into movies , videos, music_videos , music and pictures. The real directories for these on my central server are /videos/movies , /misc/vids, /misc/music_vids , /music , /camera . So I created a top level /xbmc directory with /xbmc/movies /xbmc/videos /xbmc/music_videos /xbmc/pictures

sudo mkdir /xbmc

sudo ln -s /videos/movies /xbmc/movies
sudo ln -s /misc/vids  /xbmc/videos
sudo ln -s /misc/music_vids /xbmc/music_videos
sudo ln -s /music  /xbmc/music
sudo ln -s /camera  /xbmc/pictures

Now when I share out /xbmc everything is nicely organized.

Configure SAMBA

sudo vi /etc/samba/smb.conf

Ensure your network interfaces are in the interfaces =   line and remove the ; at the beginning of the line.

Add these lines after the interfaces line , where the IP address after 127.0.0.1 is the IP address of your XBMC box assuming it has a static IP, if you are using DHCP for the XBMC server then put in the DCHP subnet e.g. 192.168.1.0/24

hosts allow = 127.0.0.1,192.168.1.45
hosts deny = 0.0.0.0/0

Remove the ; from the line bind interfaces only = yes

If using symlinks then add this line :-

unix extensions = no

Remove the hash at the beginning of the line security = user

Search for socket and add the line

socket options = IPTOS_LOWDELAY TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

At the end of the file add :-

[xbmc]
comment = XBMC share
path = /xbmc
read only = yes
guest ok = no
user = xbmc
follow symlinks = yes
wide links = yes

Save the file

Create a linux user with enough permissions to be able to read your media files and a shell of  /bin/false – do not create a linux password for the user – we only want the user to login via SAMBA

sudo groupadd xbmc

sudo useradd -d /xbmc -c “XBMC SAMBA user” -g xbmc -s /bin/false xbmc

sudo smbpasswd -a xbmc

Restart SAMBA

sudo /etc/init.d/smbd restart

Add the share in XBMC

Video – Add Source

Path is  smb://192.168.1.45/xbmc        ( use the IP address of your SAMBA server )

OK – it will then ask for a username and password and if you select

2 thoughts on “Setup SAMBA on Ubuntu for XBMC shares”

  1. Brilliant tutorial.

    As Steve Robinett above said, this is the most useful article on the internet for getting xbmc + Samba to work together!

    By the way, I particularly appreciated you explaining how to get the soft links setup in the config file.

Leave a Reply

Your email address will not be published. Required fields are marked *