2

There are a million versions of this exact question out in google land but I've been unable to solve my problem (sorry). I have created a Samba share on Ubuntu 14.04 (actually xbmcbuntu) that I can connect to and read from, but not write to (from my Mac). I have followed a few different tutorials to get things set up so I probably have configured something incorrectly along the way.

The directory I am sharing (/home/xbmc/raid/media) is owned by the user xbmc and has permissions set to 775.

xbmc@xbmc:~$ ls -al raid
total 28
drwxr-xr-x  4 xbmc xbmc  4096 Sep  4 23:22 .
drwxr-xr-x 23 xbmc xbmc  4096 Sep  4 23:00 ..
drwx------  2 root root 16384 Sep  2 21:34 lost+found
drwxrwxr-x  9 xbmc xbmc  4096 Sep  4 22:58 media

If I change permissions to 777 I am able to write to the share but this feels like an inappropriate solution.

My smb.conf is as follows;

[global]
workgroup = WORKGROUP
server string = %h server (Samba, XBMC)
netbios name = XBMCbuntu
dns proxy = no
name resolve order = hosts wins bcast
#guest account = xbmc
load printers = no
show add printer wizard = no
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
encrypt passwords = true
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes
map to guest = bad user
security = user
username map = /etc/samba/smbusers

[System]
path = /home/xbmc/.xbmc
comment = XBMC System Share
writeable = yes
browseable = yes
guest ok = no

[Media]
path = /home/xbmc/raid/media
comment = xbmc media
writeable = yes
browseable = yes
guest ok = no

and /etc/samba/smbusers is as follows;

xbmc = xbmc

I've done a lot of fiddling with my smb.conf but haven't fixed anything. Any suggestions?

1

Try to add this to [Media] section:

public = no
hide unreadable = yes
printable = no
force create mode = 0664
force group = xbmc
write list = xbmc
directory mask = 0775

Do you authenticate to samba share as user xbmc under MacOS?

2
  • OK, that worked, althought I don't fully understand it. Am I opening myself to any security issues here (not that security is particularly important in my situation)? – brad Sep 6 '14 at 12:10
  • It's cool, my statements assure that any file & directory written by samba will have xmbc as user & group and there will be proper permissions to let samba modify them in future. – Scyld de Fraud Sep 6 '14 at 16:28
0

In your smb.conf file Instead of using writeable=yes you must try using write list=name_of_user

Also you must set the selinux context to samba_share_t on the directory media as follows :

semanage -fcontext -a -t samba_share_t '/home/xbmc/raid/media(/.*)?'

And then you need to run this command :

restorcon -RvF /home/xbmc/raid/media

Everything else looks fine in your configuration file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.