You are not logged in.

#1 2010-01-15 07:05:34

Kasumi_Ninja
Member
Registered: 2009-12-31
Posts: 54

Problems mounting usb stick with consistent permissions

When I move my todo text files to my blackberry they are marked as 'executable'. I want to fix this by setting permissions with umask= in fstab. The following setting didn't work. 

LABEL=BLACKBERRY /media/blackberry vfat user,umask=777 0 0

I get permission denied when I try to enter /media/blackberry. I tried chmodding /media/blackberry to no avail. Anyone has an idea which option need to be set in fstab in order to mount an fat32 device with persistent permissions?

Offline

#2 2010-01-15 17:11:34

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Re: Problems mounting usb stick with consistent permissions

Perhaps "users" is what you need?


Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

#3 2010-01-15 23:35:31

chlg
Member
Registered: 2010-01-13
Posts: 10

Re: Problems mounting usb stick with consistent permissions

If you set umask=777, that means that all files and directory from this file system (from BLACKBERRY) will have permission 000 (no read, no write, no execute, whoever you are).
This is the case, including for the root directory of your file system.
vfat has no permissions. So permissions come from the umask. You cannot chmod things in your partition. You chmod has no effect here.

Since vfat has no permissions, the permissions are the default one, BUT the one masked by umask.
If you want to remove execute permission, you have to choose umask=111
But then you will not be able to do anything, since you need "x" flag on directories.

The solution is then not to use umask but fmask and dmask (eg, dmask=000 fmask=111 ; or dmask=077, fmask=177 - depends on the permission you want to grant to other users)

Last edited by chlg (2010-01-15 23:36:06)

Offline

#4 2010-01-16 14:52:25

Kasumi_Ninja
Member
Registered: 2009-12-31
Posts: 54

Re: Problems mounting usb stick with consistent permissions

lilsirecho wrote:

Perhaps "users" is what you need?

Thanks for the help, I changed 'user' to 'users' but the problem persisted.

Offline

#5 2010-01-16 14:57:56

Kasumi_Ninja
Member
Registered: 2009-12-31
Posts: 54

Re: Problems mounting usb stick with consistent permissions

chlg wrote:

If you set umask=777, that means that all files and directory from this file system (from BLACKBERRY) will have permission 000 (no read, no write, no execute, whoever you are).
This is the case, including for the root directory of your file system.
vfat has no permissions. So permissions come from the umask. You cannot chmod things in your partition. You chmod has no effect here.

Since vfat has no permissions, the permissions are the default one, BUT the one masked by umask.
If you want to remove execute permission, you have to choose umask=111
But then you will not be able to do anything, since you need "x" flag on directories.

The solution is then not to use umask but fmask and dmask (eg, dmask=000 fmask=111 ; or dmask=077, fmask=177 - depends on the permission you want to grant to other users)

Thanks, your suggestion worked! Are the dmask and fmask permission the same permission you set with chmod? That way  'dmask=000' no one has permission, fmask=111= owner,group,other have execute permission. However this doens't seem the case with the following line in fstab I can add files and folders to my blackberry:

LABEL=BLACKBERRY /media/blackberry vfat noauto,users,dmask=000,fmask=111 0 0

# ls -la /media/

drwxrwxrwx  4 Kasumi_Ninja   root      16384 Jan 16 15:56 blackberry

Last edited by Kasumi_Ninja (2010-01-16 14:59:27)

Offline

#6 2010-01-16 23:37:41

chlg
Member
Registered: 2010-01-13
Posts: 10

Re: Problems mounting usb stick with consistent permissions

No. dmask and fmask are the same mask you type in "umask".
That is, roughly, the reverse.
I suppose you know that to understand these masks you have to take into account the fact they are octal string of a bit mask.
Ie
000 = 000 000 000
111 = 001 001 001
777 = 111 111 111

and that these bits read
rwx(owner) rwx(group) rwx(world)

What you give to chmod are mask where 1 means "can do" and 0 means "cannot do"
What you give to umask are mask where 1 means "cannot do", and 0 means "might be able to do if chmod is ok for that ^^"

The point of umask is to add restriction on what you can do.

Since on vfat, the files has no permissions (understand : anybody can do whatever he wants to), for vfat umask is roughly the reverse of chmod. So 111 is "nobody can execute"

BTW : "users" ou "user" is not related to your problem
"user" means that any user can mount the filesystem, but only the user who's mounted it can unmount it
"users" means "any user can mount or unmount the filesystem"

Last edited by chlg (2010-01-16 23:38:23)

Offline

Board footer

Powered by FluxBB