I need some assistance in improving my understanding of file permissions and masks.
I have a basic understanding of file permissions--what r,w,x mean for user, group, other. I don't understand sticky bits but it sounds like I don't need to--please correct me if I'm wrong.
I believe where I really need to improve my knowledge is masks.
umask - I think this is a default mask applied to all files (regardless of their current permissions, assuming you have complete access to the file).
fmask (depreciated for file_mode) - I thought this would set the permissions of any newly file created.
dmask - sets dir permissions
Where I am running into trouble:
I mount a CIFS remote file system. When I copy a file to that system I need the permissions to come up -rwxrwxrwx. What happens is the permissions come up -rw-rw-r-- and it seems this mask is applied no matter what I do. Below you will see several examples I hope illustrate what's happening:
1st mount command: mount -t cifs //remotesystem/share1 ./localdir -o username="myusername"
after normal mount (no umask or any masks) and then copying TestFileC.txt
-rwxrwSrwt 1 root root 167705 May 16 00:41 TestFileA.txt
-rwxrwSrwt 1 root root 171681 Jun 2 10:27 TestFileB.txt
-rw-rw-r-- 1 root root 192374 Jun 2 10:59 TestFileC.txt
-rwxrwSrwt 1 root root 135626 Jun 1 13:00 TestFileD.txt
umount ./localdir
2nd mount command: mount -t cifs //remotesystem/share1 ./localdir -o username="myusername",umask=777
after mount with umask=777 and then copying TestFileE.txt
-rw-rw-r-- 1 root root 258297 Jun 2 12:00 TestFileE.txt
-rwxrwxrwx 1 root root 167705 May 16 00:41 TestFileA.txt
-rwxrwxrwx 1 root root 171681 Jun 2 10:27 TestFileB.txt
-rwxrwxrwx 1 root root 192374 Jun 2 10:59 TestFileC.txt
-rwxrwxrwx 1 root root 135626 Jun 1 13:00 TestFileD.txt
umount ./localdir
* Note TestFileC.txt received the correct mask. I suspect this is because of the way I mounted the share. When I copied in TestFileE.txt it recieved the wrong mask and appears -rw-rw-r--
3rd mount command: mount -t cifs //remotesystem/share1 ./localdir -o username="myusername",file_mode=0666
after mount with file_mode 0666 and then copying TestFileE.txt (deleted and then copied again)
-rw-rw-r-- 1 root root 258297 Jun 2 12:12 TestFileE.txt
-rw-rw-rw- 1 root root 167705 May 16 00:41 TestFileA.txt
-rw-rw-rw- 1 root root 171681 Jun 2 10:27 TestFileB.txt
-rw-rw-rw- 1 root root 192374 Jun 2 10:59 TestFileC.txt
-rw-rw-rw- 1 root root 135626 Jun 1 13:00 TestFileD.txt
A few additional details:
client is RHEL r5.1 (Tikanga)
fileserver ("remotesystem") is Windows 2000 AE
mount entry is not in /etc/fstab
I don't know if I have provided enough information. Please let me know if you need something more.
My goal and question:
How do I set up a mask so that when I copy or create new files in the share they receive the correct and default mask -rwxrwxrwx?
Thanks!
___________________________
In case this is pertinent to my question, here is my fstab:
Code:
cat /etc/fstab
LABEL=/1 / ext3 defaults 1 1
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
LABEL=SWAP-sda2 swap swap defaults 0 0