Finding what is causing this takes a very methodical approach.
First start the machine where your Samba share resides. If that folder is mounted from a drive in fstab, then disable that line in fstab. You need to look at the permissions of the empty folder, not what is mounted to that point.
For example, I have a server that holds a lot of files that I might work on or access from other machines, but let's just look at my desktop and, for an example, I'll use the folder that I store music in. On the server there is a folder named MUSIC in the /home folder. When the server boots it mounts a specific drive (sdg1 in my case) to that folder. So I have a line in the fstab file which looks like this:
Code: Select all
UUID=58828b62-2ada-4d87-a559-1d225fbc4384 /home/chris/MUSIC ext4 defaults 0 0
So, for this exercise I'd need to comment out that line with a # at the beginning of the line and reboot the machine. Now I can negotiate my way to the folder at /home/MUSIC which will, of course, be empty but I can look at the permissions for that folder only, not what would otherwise be mounted there. Using ls -l I get:
Which tells me that I, as the owner, can read, write and modify and so can members of my group as well as any others. This is what I want, so it's ok. There's more on this line but it's not relevant here, so I've left it out.
Now I need to edit fstab again, this time removing the # from the beginning of the line that mounts the drive to the folder at /home/chris/MUSIC. I do that and reboot.
This time, when I run ls -l I get
This tells me that what is now mounted there has the same permissions (read, write and modify) for myself, my group and others.
Just a note here - I allow others permission to read, write and modify because other members of my family might want to add files to our music collection. If this was more sensitive data then the permissions might be different, as perhaps they may be depending on who might have access to this drive. You need to make your own decisions on this for your case.
Now have a look at your Samba configuration file, which is /etc/samba/smb.conf. I use Kate, but you could use your text editor or nano or vim. At or near the end of smb.conf is a section, as follows:
Code: Select all
[MUSIC]
path = /home/chris/MUSIC
available = yes
browsable = yes
public = yes
writable = yes
These permissions must agree with those you've set for the individual files and/or folders. If not, make any necessary changes, save the file and reboot.
Now move to your client machine, in my case, my desktop. As above, when booting, the share folder MUSIC is mounted to /home/chris/MUSIC. This is done in fstab by the line:
Code: Select all
//10.1.1.10/MUSIC /home/chris/MUSIC cifs uid=1000,credentials=/home/chris/.smb,file_mode=0775,dir_mode=0775 0 0
Note that I use a credentials file to ensure that correct information is relayed to the server on who I am and therefore should be allowed access,
Repeat the exercise that you've just completed on the other machine, checking permissions of the folder that you're mounting the share drive to.
If I run ls -l I get:
I could, if I wanted, give my group permissions instead of the root group and achieve almost the same result but since I'm the only one who uses this machine it doesn't matter. Make your own decision here. Others can read only since there shouldn't be any others on this machine. Note that on the PC that runs our audio visual, in the lounge next to the TV and sound systems, that I allow much more relaxed permissions since any one of the family might be signed in there. Again, look at your use case and make appropriate decisions.
If you have a /etc/samba/smb.conf file on the client machine then check permissions there, just as done before on the server.
One final word. If you're mounting drives from remote machines and using fstab to do it on boot, then I've generally found it's a better idea to create the mount point yourself (so it gets your permissions), preferably somewhere in your /home folder. If you let fstab create the mount point then it will get root permissions, unless you specify otherwise in fstab. I find that all too complex, so just create the mount points myself. Only need to do it once and their permissions are what I need.