making a fat32 partition read-only or unaccessible for a user, but rw to another
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
making a fat32 partition read-only or unaccessible for a user, but rw to another
I have a very neglijent user that I have to let on my computer and I'm concerned about some data I have on a fat32 partition. (with my home dir it was much simpler... I should make it an ext3 partition as soon as I get enough time to make a backup)
The question is, can I either mount it as read-only for his user and rw for mine, or mounting it just when I log in, or anything?
I was thinking of the following things I could do:
1) mounting it in a folder, for example, /mnt/folder1/folder2 and making folder1 readable only for my user. It should block the access of the user and it's fairly simple.
2) when are the scripts in init.d run? Before or after login? If it's after, I could write a script that mounts it by certain parameters according to the user that is logged in.
Which one would be better? Or do you have any other suggestions? Or any security tips I should use to keep my computer safe?
You can mount the FAT32 partition as rw for root & read only for all others,
So that when you want to write to the partition you can su/login as root and write(I prefer being logged as normal user and change to root by executing the program from shell after su/sudo if I have to write to mounted partition) and for others the partition is read only
uid=username --sets the owner of the drive to a specific user name.
gid=groupname --sets the group name the drive will have.
umask=000 --sets the permissions level for the drive. The number is the inverse of the actual permissions you want. 000 would equal 777 permissions. There are also fmask and dmask options for files and directories if you want more fine-grained control.
What I'd probably do is create a "fatdrive" group and set the gid to that, then use umask to set the drive permissions to 775 (umask=002) or such, so that only the owner and members of the group have full write access. Then I can simply refuse group membership to any user I don't want to give write access to.
David the H., I was wondering once what uid,gid and umask were... Thanks, it is a much better and easier method this way Although I think I'll make it writable to the user only and readable by the group (if I remember what the chmod value is, and find out what the umask value for that is... but I'll google this one)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.