I have samba share for a directory which is owned by root. But the samba user is different and same is put in the config. Due to this when user access the directory it has read access but can't write to those directories. I don't want root to be as samba user and also don't want to change directories to have 777 permissions. Is there a way I can allow writes from non root user to this directory. For reference below is the config I have setup for samba.

]# cat smb.conf
# Global parameters
       workgroup = myworkgroup.test.com
       netbios name = SAMBA
       server string = Samba Server %v
       map to guest = Bad User
       log file = /var/log/samba/log.%m
       max log size = 50
       socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
       preferred master = No
       local master = No
       dns proxy = No
       security = User

# Share
       path = /test
       valid users = test
       read only = No
       create mask = 0777
       directory mask = 0777

Here /test owns by root.


You can add samba user to the group that owns /test path and apply 770 permission. If it is owned by root group, then I would suggest making a separate group for samba for this and use that instead, as adding samba to root group would let samba access too much.

  • A test is owned by root group and if we create new group and add it still I need to add this group to root group which will open all the stuff. – Abhinav May 13 '14 at 9:39
  • Abhinav, you are wrong. Edvinas suggests creating a new group, of which your user is a secondary member, the sole function of which is to group-own the directory in question, and to give that directory group-write permissions. (S)he isn't suggesting adding your user to the root group, which would indeed be foolish. This is exactly the sort of scenario that custom groups are useful for. – MadHatter Oct 25 '14 at 8:09

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.