Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1601031

Summary: changing file mode on cifs mounted share is not reflected properly
Product: Red Hat Enterprise Linux 7 Reporter: Niranjan Mallapadi Raghavender <mniranja>
Component: cifs-utilsAssignee: Ronnie Sahlberg <lsahlber>
Status: CLOSED DUPLICATE QA Contact: xiaoli feng <xifeng>
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.6CC: adzilsky, gdeschner, jarrpa, jstephen, lsahlber, mniranja, swhiteho, xzhou
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-08-09 23:19:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1611101    
Bug Blocks:    
Attachments:
Description Flags
samba client logs.
none
smbd server logs none

Description Niranjan Mallapadi Raghavender 2018-07-13 15:59:30 UTC
Description of problem:

changing file mode on cifs mounted share is not reflected properly .  After mounting the cifs share and running chmod to change access permissions is not reflected as expected. 

Version-Release number of selected component (if applicable):
samba-4.8.3-1.el7.x86_64
kernel-3.10.0-919.el7.x86_64

How reproducible:


Steps to Reproduce:

1. Setup samba server on RHEL7.6 

2. Join the samba server to Windows Active Directory 
$realm join  -v JUNO.TEST --user Administrator --membership-software adcli

3. Configure smb.conf as below:
[global]
workgroup = JUNO
security = ads
realm = JUNO.TEST
kerberos method = system keytab
netbios name = smbserver01
ntlm auth = no
load printers = no
printing = bsd
log file = /var/log/samba/log.%m
max log size = 500
log level = 10
map acl inherit = Yes
store dos attributes = Yes

[share1]
path = /mnt/samba/share1
comment = test share1
writable = yes
printable = no

4. create directory /mnt/samba/share1

5. Make sure "Domain Users" have permissions to /mnt/samba/share1

[root@smbserver01 samba]# ls -ld /mnt/samba/share1
drwxrwx---. 2 root domain users 50 Jul 13 10:11 /mnt/samba/share1

6. Configure another RHEL7.6 client using 
cifs-utils-6.2-10.el7.x86_64
kernel-3.10.0-919.el7.x86_64


7. Run kinit as AD user to get TGT

[root@smbclient01 ~]# kinit idm_perf_user1
Password for idm_perf_user1:

8. Mount cifs share using krb5 credentials

[root@smbclient01 ~]# mount -t cifs -o cifsacl -o sec=krb5 -o username=idm_perf_user1 //smbserver01.juno.test/share1 /mnt/samba/share1

9. Create a file file1.txt in /mnt/samba/share1 directory 

[root@smbclient01 share1]# ls -l file1.txt
-rwxr--r--. 1 idm_perf_user1 domain users 0 Jul 13 10:11 file1.txt

10. Change the file permissions to 600.txt

[root@smbclient01 share1]# chmod 600 file1.txt
[root@smbclient01 share1]# ls -l file1.txt
-rw-r--r--. 1 idm_perf_user1 domain users 0 Jul 13 10:11 file1.txt

Actual results:

[root@smbclient01 share1]# chmod 600 file1.txt
[root@smbclient01 share1]# ls -l file1.txt
-rw-r--r--. 1 idm_perf_user1 domain users 0 Jul 13 10:11 file1.txt



Expected results:

-rw-------. 1 idm_perf_user1 domain users 0 Jul 13 11:57 file1.txt


Additional info:

Comment 3 Niranjan Mallapadi Raghavender 2018-07-13 16:13:51 UTC
Created attachment 1458765 [details]
samba client logs.

Comment 4 Niranjan Mallapadi Raghavender 2018-07-13 16:21:53 UTC
Created attachment 1458767 [details]
smbd server logs

Comment 5 Niranjan Mallapadi Raghavender 2018-07-13 16:30:43 UTC
On RHEL7.5 systems the above issue is not seen. 


RHEL7.5 Samba server configured as below:

[root@smbserver02 mnt]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.5 (Maipo)

smb.conf:

[global]
workgroup = JUNO
security = ads
realm = JUNO.TEST
kerberos method = system keytab
netbios name = smbserver02
ntlm auth = no
load printers = no
printing = bsd
log file = /var/log/samba/log.%m
max log size = 500
log level = 10
map acl inherit = Yes
store dos attributes = Yes

[share1]
path = /mnt/samba/share1
comment = test share1
writable = yes
printable = no


On RHEL7.5 Samba client mount the share1 using cifs

$ klist

[root@client share1]# klist
Ticket cache: KEYRING:persistent:0:0
Default principal: idm_perf_user1

Valid starting       Expires              Service principal
07/13/2018 09:46:38  07/13/2018 19:00:04  cifs/smbserver02.juno.test
        renew until 07/20/2018 08:59:40
07/13/2018 09:00:04  07/13/2018 19:00:04  krbtgt/JUNO.TEST
        renew until 07/20/2018 08:59:40


$ mount -t cifs -o cifsacl -o sec=krb5 -o username=idm_perf_user1 //smbserver02.juno.test/share1 /mnt/samba/share1

$cd /mnt/samba/share1

[root@client share1]# touch file2.txt
[root@client share1]# ls -l file2.txt 
-rw-r--r--. 1 idm_perf_user1 domain users 0 Jul 13 12:29 file2.txt

[root@client share1]# ls -l file2.txt 
-rw-------. 1 idm_perf_user1 domain users 0 Jul 13 12:29 file2.txt

Comment 6 Niranjan Mallapadi Raghavender 2018-07-13 16:33:20 UTC
Versions on RHEL7.5 samba server
samba-4.7.1-6.el7.x86_64
kernel-3.10.0-862.el7.x86_64

on RHEL 7.5 samba client 
kernel-3.10.0-862.el7.x86_64
cifs-utils-6.2-10.el7.x86_64

Comment 7 Niranjan Mallapadi Raghavender 2018-07-23 03:39:23 UTC
Any update on this ?

Comment 9 xiaoli feng 2018-08-01 10:13:39 UTC
Hello Niranjan,

  Since the default SMB protocol is different between RHEL-7.5 and RHEL-7.6. It's hard to judge if it's a regression issue from comment 5. Could you test again to mount with vers=3.0 on RHEL-7.5 please? Then compare the result with RHEL-7.6. 

Thanks.

Comment 10 Niranjan Mallapadi Raghavender 2018-08-01 17:50:47 UTC
I did the following tests on RHEL7.6 systems. 

1. Have 2 RHEL7.6 systems, with one as samba server and other as samba client

Configure 1 RHEL7.6 system as samba server with below configuration:

[global]
        workgroup = TEST1
        security = user
        passdb backend = tdbsam
        printing = cups
        printcap name = cups
        load printers = yes
        cups options = raw

[foobar]
        path = /foobar
        browseable = yes
        writeable = yes
        public = yes

2. create some local users called foo1 and foo2 and have them added to samba users using smbpasswd

3. Make sure foo1 and foo2 have write access to /foobar

4. Mount the share on another RHEL7.6 system using below command:

$ mount -t cifs //host-8-241-220.host.centralci.eng.rdu2.redhat.com/foobar /mnt -o username=foo1,password=redhat -o vers=1.0

cd /mnt

ls -l

total 0
-rw-r--r--. 1 foo1 foo1 0 Aug  1 13:39 a


[root@host-8-251-85 mnt]# chmod 600 a


[root@host-8-251-85 mnt]# ls -l
total 0
-rw-------. 1 1001 1001 0 Aug  1 13:39 a


Now mount the share with version:3.0 

[root@host-8-251-85 ~]# mount -t cifs //host-8-241-220.host.centralci.eng.rdu2.redhat.com/foobar /mnt -o username=foo1,password=redhat
[root@host-8-251-85 ~]# cd /mnt
[root@host-8-251-85 mnt]# ll
total 0
-rwxr-xr-x. 1 root root 0 Aug  1 13:49 a
-rwxr-xr-x. 1 root root 0 Aug  1 13:49 b

[root@host-8-251-85 mnt]# chmod 600 a
[root@host-8-251-85 mnt]# chmod 600 b
[root@host-8-251-85 mnt]# ls -l
total 0
-rwxr-xr-x. 1 root root 0 Aug  1 13:49 a
-rwxr-xr-x. 1 root root 0 Aug  1 13:49 b

[root@host-8-251-85 mnt]# ls -l
total 0
-rwxr-xr-x. 1 root root 0 Aug  1 13:49 a
-rwxr-xr-x. 1 root root 0 Aug  1 13:49 b

Comment 11 Niranjan Mallapadi Raghavender 2018-08-01 17:52:04 UTC
I am not exactly sure why version smb V 3.0 protocol should deny users from change permissions.

Comment 12 xiaoli feng 2018-08-02 02:06:06 UTC
(In reply to Niranjan Mallapadi Raghavender from comment #11)
> I am not exactly sure why version smb V 3.0 protocol should deny users from
> change permissions.

Because the smb2.0+ don't support Unix Extensions. Now it is implementing in the upstream. I will clean the regression flag because it's a feature bug or regression bug.

Hello Ronnie,
  
  Is there a plan when smb2.0+ support Unix Extensions?

Thanks.

Comment 16 Steve Whitehouse 2018-08-09 14:25:16 UTC
This doesn't sound like it should be a blocker for 7.6 to me. So taking it off the list. Do we want to keep this bug as a feature request for the samba unix extensions in due course?

Comment 17 xiaoli feng 2018-08-09 14:49:12 UTC
There is a bug bz1611101 to track smb2.0+ unix extensions feature. So maybe we can close this bug as a dup of bz1611101.

Comment 18 Ronnie Sahlberg 2018-08-09 23:19:56 UTC
Not a blocker.

*** This bug has been marked as a duplicate of bug 1611101 ***