Unix permission problems with 'attrib'
François Gouget
gouget at metaintegration.net
Tue Feb 2 19:35:03 GMT 1999
Hi,
I'm been using Samba for some time and I have been bugged by a problem with SourceSafe. I finally took some time to see what is going on and found the source of the problem (well, not in the source code though).
I'm partially responsible, I have Unix files with the following rights "r--rw---" and Samba does not deal with these very well. I am now makind sure that this case does not happen but still, I think Samba's behavior is incorrect.
Here is what happens:
$ cat /dev/null >foo
$ chmod 460 foo
$ ls -l foo
-r--rw---- 1 me me 0 Feb 2 11:01 foo
M:\> attrib foo
R M:\foo
Up to here everything is fine. foo is not writable on Unix so attrib returns that it is read-only. Let's continue...
M:\> attrib -r foo
M:\> attrib foo
R M:\foo
$ ls -l foo
-r--rw---- 1 me me 0 Feb 2 11:01 foo
Here it's wrong. "attrib -r" is supposed to make the file writable but it did not change anything. I think that's what caused the problem I had in SourceSafe. When I do a "Get Latest Version" SourceSafe is supposed to remove the read-only flag, update the file, put back the read-only file. Of course if step 1 fails... Let's try the opposite operation.
M:\> attrib +r foo
M:\> attrib foo
R M:\foo
$ ls -l foo
-r--r----- 1 me me 0 Feb 2 11:01 foo
Should Samba do this ? The file is already read-only after all. See more about that on the last part.
M:\> attrib -r foo
M:\> attrib foo
M:\foo
$ ls -l foo
-rw-rw---- 1 me me 0 Feb 2 11:01 foo
This last part proves that 'attrib' does work, some times :-). The other thing is that it seems that normally it modifies both the user and group permissions. I'm not sure this should always be the case. Maybe this could be an option of the share. For instance in user home directories you may not want to make files writable by everyone in the same group ! In my case this is what I want though.
By the way, I'm running Samba 2.0.0 on Solaris 2.5 but I had the same symptom with "1.9.18p3". The share I tested this on is a share that is "guest only" with guest being "me/me". I also have "Map archive", "Map System", and "Map Hidden" disabled. Here is swat's view of this share:
# Global parameters
[...]
map archive = No
[Shared]
path = /shared
guest account = me
read only = No
create mask = 0774
guest only = Yes
guest ok = Yes
hide dot files = No
--
François Gouget
More information about the samba
mailing list