Samba How to allow a user to access folder (read/write) with root permission

samba

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
[global]
       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
[Data]
       path = /test
       valid users = test
       read only = No
       create mask = 0777
       directory mask = 0777

Here /test owns by root.

Best Answer

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.