I have a network drive that is available via a Samba share. I want to create, edit, read/write files on that shared drive from Windows 10 and from Ubuntu mate.
I noticed that when I created a file from Linux I could not edit it from Windows. Also, when I rsync'd a lot of files from Windows (NTFS) to the shared drive (ext4) I could view them but not edit them from Ubuntu. The command I used was...
sudo rsync -rltzhHvn --info=progress2 "/media/ubuntu-mate/DATA/Personal Stuff" "/media/ubuntu-mate/4TB1/DataShare/Personal-Stuff"
I understand a bit about Linux permissions and Samba so this is a solution I'm thinking of using...
- Create an Ubuntu user account (ubuntu-user) that does not have root access. Only use sudo on rare occasions I really need to.
- Files that are created in Ubuntu will have owner/group like -->
ubuntu-user:ubuntu-user - I will configure the Samba share like..
force user = ubuntu-user create mask = 0666 directory mask = 0777
- Now Windows should be able to edit/delete files that were created in Ubuntu and also create files that can be edited/deleted in Ubuntu.
Do I have it right or is there a better way?
For instance what if file is created by some system process or maybe root in Ubuntu then I won't be able to read/write/edit it via the share from Windows? In this case I know that I could change the Samba share to...
force user = root create mask = 0666 directory mask = 0777
And I think that will work but now any files created from Windows won't be editable by the Linux ubuntu-user. I could just do force user = root in the Samba share and create a Linux user account with root access which would be easier but I think not advisable.
Cheers.