Basically I'm having trouble with permissions being inconsistent between Samba
and the local file system. Locally I set the file permission to -r--r--r--
with chmod 444 textfile.txt
and confirm these settings with ls -al
. Then I do a Samba mount. If I look at the same file's permissions via Samba what I see is -rwxr-xr-x
or -r-xr-xr-x
, but not -r--r--r--
. This happens even when a Linux box is looking at himself via Samba
.
I'm required to use Samba between Linux VMs using various vendors and versions (as well as Windows VMs, but this note is about Linux only.) I'm testing with CentOS 7 & 8
, RedHat 7 & 8
, OpenSUSE 15
and SUSE 15
. I get similar results from all permutations of these Linux distros. The only one that works correctly is CentOS8
as a Samba client to OpenSUSE15
as the Samba server--this is the only case where Samba
's displayed permissions match the permissions displayed locally.
Yes, NFS
would be easier, but I must get this working via Samba
. Note that this is just a test environment--some of the things below reflect my attempts to simplify the environment. Once I get things working properly, I'll tighten up security.
Here is my setup and steps:
In smb.conf
, I've shared the entire drive as C
. I've already added root to the SMB
users and assigned a password.
[global]
workgroup = WORKGROUP
wins support = yes
passdb backend = tdbsam
printing = cups
printcap name = cups
load printers = yes
cups options = raw
[C]
Path = /
Browseable = yes
Writeable = yes
only guest = no
create mask = 0777
directory mask = 0777
Public = yes
Guest ok = yes
I'm using the same VMs, steps and files, with all permutations. With all VMs, I'm logged to a bash shell as root via PuTTY.
On the Server machine, create a folder with a text file, assign permissions and verify.
mkdir /temp
cd /temp
cp /etc/samba/smb.conf /temp/smb.conf
It could be any file, I'm using smb.conf as an example.
chmod 444 smb.conf
ll smb.conf
-r--r--r-- 1 root root <size> <date> smb.conf
From the Client machine, perform a mount command and look at the file permissions via Samba
:
mkdir /mnt/test
mount -t cifs //svrname/c /mnt/test -o username=root,password=mypasswd
In the simplest loopback case, svrname is 'localhost'.
ll /mnt/test/temp/smb.conf
-rwxr-xr-x 1 root root <size> <date> smb.conf
I need the Samba
view of permissions for that file to match the local permissions, like this:
ll /mnt/test/temp/smb.conf
-r--r--r-- 1 root root <size> <date> smb.conf
However other than that one case mentioned above, I always see -rwxr-xr-x
or -r-xr-xr-x
.
I've tried all sorts of things but with no luck. Any ideas?
Thanks, Jeff