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.
Hello folks,
I have recently purchased a new hard disk. I have earmarked one partition (NTFS) each for my kids. These are NTFS since my objective is that these partitions should be accesible from windows too. I have put appropriate entries in the fstab so that when the linux starts the two partitions are mounted with correct ownerships and permissions.
No problem - it is working fine.
But I was thinking that I should delay the mounting till the kids log in. In addition , the correct partition only should mount (and not both the partitions) depending upon who is logging in.
Is there any way by which it could somehow be done.
You could put the commands to mount the partition(s) in user shell startup script(s), such as .bashrc. You will then need to put in code to test whether the partition is already mounted, but then how will you handle automatic unmounting? Messy. Let us know if you come up with something that works well.
--- rod.
Why not go ahead and mount it but use groups to set the permissions to rw to the drives? Kid A (a member of group One) can see partition One but not partition Two. Kid B (a member of group Two) can see partition Two but not partition One.
You could put the commands to mount the partition(s) in user shell startup script(s), such as .bashrc. You will then need to put in code to test whether the partition is already mounted, but then how will you handle automatic unmounting? Messy. Let us know if you come up with something that works well.
--- rod.
True, but you would only want umount to occur on the last logout, which requires some book-keeping to keep track of. Moreover, a user may be logged in without any shell running. I'm not sure what happens when users simply close a terminal window without actually typing 'logout/exit'; does something trap this event and execute a shell logout?
--- rod.
Why not go ahead and mount it but use groups to set the permissions to rw to the drives? Kid A (a member of group One) can see partition One but not partition Two. Kid B (a member of group Two) can see partition Two but not partition One.
This makes the most sense to me. At least one benefit of this would be that the locate database would be kept up-to-date for both partitions if updatedb is run on an automatic schedule.
--- rod.
Why not go ahead and mount it but use groups to set the permissions to rw to the drives? Kid A (a member of group One) can see partition One but not partition Two. Kid B (a member of group Two) can see partition Two but not partition One.
Does NTFS support UNIX style permissions? I'd also test to see how setting the owning group/user and modifying the permissions of a file ultimately effects Windows.
The same effect could be obtained by following command:
mount -t ntfs -o uid=500,gid=500,umask=077 /dev/sda9 /mnt/sda9
But this can be done only by the root.
Thus executing this command from the bash start up script of a user is not possible.
But that gives me an idea. Can I make the user the owner of the device /dev/sda9 (which is presently owned by root). And by incorporating this change would this ordinary user be able to mount the partition. Will have to check out.
Will changing the ownership of a disk device from root to an ordinary user have any serious side-effects ?
Any more ideas ?
Thanks
Prabhat Soni
Last edited by prabhatsoni; 01-08-2008 at 09:25 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.