Setting up samba shares in Ubuntu

One step of moving over from Mac OS X to Ubuntu was setting up my file shares that I’m using for serving media content to Openelec. For OS X I’ve used SMBUp to configure the folder sharing. Ubuntu supposedly makes it easy to share a folder, you just right click the candidate and choose “Share in local network“. However, while the shared folders were presented to clients, I was not able to mount them right away. In order to get a decent error message, I used the command line tool smbclient to connect to a share:

smbclient // -N

The connection was opened, but when trying to list files (using the ls samba command), I was presented with the error NT_STATUS_ACCESS_DENIED. After some research, I found that you can use the force user configuration option to assign a default user for samba to use when sharing files. Initially I added this to individual shares, but it also works in the global section of the configuration.

Here’s my complete samba configuration for reference:

server string = %h server (Samba, Ubuntu)
server role = standalone server
map to guest = Bad User
obey pam restrictions = Yes
pam password change = Yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
unix password sync = Yes
syslog = 0
log file = /var/log/samba/log.%m
max log size = 1000
dns proxy = No
usershare allow guests = Yes
panic action = /usr/share/samba/panic-action %d
idmap config * : backend = tdb
force user = username
create mask = 0700
guest ok = Yes

path = "/media/username/DataHD/Shares/S02
directory mask = 0777

path = "/media/username/DataHD/Shares/S01
directory mask = 0777

Leave a Reply

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