Bug 8030 - cifs mount: change of file permission fails
Summary: cifs mount: change of file permission fails
Alias: None
Product: CifsVFS
Classification: Unclassified
Component: kernel fs (show other bugs)
Version: 2.6
Hardware: x64 Linux
: P5 normal
Target Milestone: ---
Assignee: Jeff Layton
QA Contact:
Depends on:
Reported: 2011-03-22 13:34 UTC by Frank Paeffgen
Modified: 2012-05-05 11:20 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Frank Paeffgen 2011-03-22 13:34:18 UTC
we have a old server with opensuse 10.1 and samba 3.0.22 installed.
There we are able to copy files from itself to a windows 2003 Server and the file permissions will be changed to 777. This change does not depend on the permissions the files have on the source server.
permission 222 will be changed to 777
permission 555 will be changed to 777.
This works fine.

Now we have a new server with sles 11.1 sp1 and samba installed.
Files with the permission 222,333,666 get new permission 777 after being copied.
Files with the permission 444 or 555 don´t get any permission-change after being copied. This is what we don´t want. These permissions shall be changed automatically too.

We have tried using the smbfstab and the /etc/fstab.
Both types of entry gave the same result. 
Here is the row at the /etc/fstab:
//     /mnt/server_path       cifs    credentials=/etc/fstab-cred-admin.txt,noperm,file_mode=0777,dir_mode=0777,iocharset=iso8859-15 0 0

The user admin belongs to the admin-group at the w2k3 server.
We have tested this with opensuse 11.4 too. Same result.

Hopefully being at the right position.
Thanks for a hint.
Kind regards
Comment 1 Jeff Layton 2011-03-22 13:56:11 UTC
The client maps the DOS readonly bit to the inverse of the write permission bit. IOW, when the r/o bit is set on the file, the client will clear any write permission bits.

What confuses me a little is that you state:

"Files with the permission 444 or 555 don´t get any permission-change after
being copied."

...so given your mount options, the fact that 0555 permissions don't change is expected. 0444 however should change to 0555. Is that also not happening here?

Also, I'm not that familiar with SuSE versioning. Can you tell me what kernel versions you're working with?
Comment 2 Frank Paeffgen 2011-03-22 14:27:08 UTC
The result is:
-rwxrwxrwx  1 root root    0 Mar 22 15:17 222*
-r-xr-xr-x  1 root root    0 Mar 22 15:17 444*
-r-xr-xr-x  1 root root    0 Mar 22 15:17 555*
-rwxrwxrwx  1 root root    0 Mar 22 15:21 666*
-rwxrwxrwx  1 root root    0 Mar 22 15:21 777*

You are right. 444 changes to 555, as you expected.
The linux and kernel:
Linux server #1 SMP 2011-02-25 13:36:59 +0100 x86_64 x86_64 x86_64 GNU/Linux

Is there any possibility to change the permissions from 444 and 555 to 777 by changing any configuration
Is it possible to change any config so that 444 and 555 will be changed to 777 too?

Thanks in advance
Frank Paeffgen
Comment 3 Jeff Layton 2011-03-22 14:37:16 UTC
Not currently, no. The DOS read-only bit is mapped this way unconditionally. I suppose you could add yet another mount option to give you the behavior you want, but I'm a bit reticent to suggest that since this seems like a very specialized use case.
Comment 4 Frank Paeffgen 2011-03-23 06:51:26 UTC
we have tried a lot of different mount options. Nothing worked. It was equal which user was used or which file_mode was given. 

555 is unchanged today.

Would it be possible to use an old version of samba with the old smbmount?
Like we use it up to now at the old linux (samba 3.0.22)?

Kind regards
Frank Paeffgen
Comment 5 Jeff Layton 2011-03-23 11:42:41 UTC
(In reply to comment #4)
> Would it be possible to use an old version of samba with the old smbmount?
> Like we use it up to now at the old linux (samba 3.0.22)?

cc'ing Suresh since you mention you're using SuSE. I'm not sure I understand your question...

smbmount is for smbfs. cifs doesn't use that. Switching to an older mount.cifs won't help this as this is all handled by the kernel. Switching to smbfs might give you what you want but it's more or less deprecated in more recent kernels.
Comment 6 Jeff Layton 2011-03-23 11:54:00 UTC
Sorry if I wasn't clear before, when I said "you could add another mount option", I meant that you (or someone) could do a patch to add such a mount option to the code.
Comment 7 Suresh Jayaraman (mail address is dead) 2011-03-25 11:20:11 UTC
Sorry about the delay in catching up. If I understand the problem and Jeff's response correctly, the behavior exhibited by SLES11 cifs is the expected one.

This is surely a specialized way of using CIFS and it is not clear why such mapping would be beneficial in real world scenario. If we can find the scenario compelling and useful we could think of implementing it and see what the CIFS community's take on this.
Comment 8 Frank Paeffgen 2011-03-28 06:26:26 UTC

this behavior does not belong to SLES 11.1. We have checked it with suse 11.3, 11.4 and Ubuntu 10.04 - all the same.

If the user at his unix-side says file_mode=0777 then he expects that all the files get 0777.
I can not see a special use here.

It would be very useful if there is a option to handle this.

Kind regards
Frank Paeffgen
Comment 9 Jeff Layton 2012-05-05 11:20:10 UTC
No patch has materialized to change this, and I don't forsee anyone doing
one in the future, so I'm going to go ahead and close this WONTFIX. If you
want to propose such a patch, it's probably best discussed on linux-cifs@vger.kernel.org.