Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Open your /etc/fstab file in an editor, and add the "user" option to all the devices that you would like to allow regular users to mount. For instance, here is a line from my /etc/fstab for my USB pendrive:
/dev/sda1 /media/pendrive vfat noauto,rw,user 0 0
Your USB drive will likely be the same device unless you have SCSI disks in your system; in which case, you's probably be familiar enough to know what to change. Save the file, and then regular users should be able to mount and unmount those devices at will.
Really? It won't let you execute mount /dev/sda1 as a regular user? That's a bit odd if I may say so. My system will allow a regular user to mount using either the device itself or the mountpoint. I just double-checked and that the user I tested with isn't in any special groups or anything like that. I can't say anything comes to mind about why you're seeing that behavior.
For vfat partitions, you can use the 'uid=' and 'gid=' options. For pendrives however, they are usually mounted dynamically by the hotplug system, rather than having an entry for the device in /etc/fstab.
Originally posted by jschiwal For pendrives however, they are usually mounted dynamically by the hotplug system, rather than having an entry for the device in /etc/fstab.
True, but if the pendrive is the only USB device that's being used (or used frequently), then adding an entry in /etc/fstab isn't going to hurt anything.
Also, if the system is using udev (2.6 series kernel), udev can be configured to assign a specific device to a specific designation. For instance, assigning the pendrive to /dev/sda1. I haven't done this myself (I fall into the pendrive-is-the-only-device category), but it makes adding an entry in /etc/fstab very useful in this case as well.
An sda1 entry may not work for 100% of the people, but it's probably useful for a large group.
I agree with dark_helmets advice. The direct answer is to use the 'uid' and 'gid' in the fstab entry to change the ownership and group ownership of the pendrive. If you don't remove the drive, then an fstab entry is great, but if a device isn't present, and if the /etc/fstab entry results in the partition being mounted during boot, then the computer won't finish booting because the device isn't present.
So adding the 'user' option would be a good idea. It may be an idea to include a test for the device in the users ~/.profile script and mount it at that time. This would allow the mounting to be done transparently, and only mount it for that user. I think that is what 'a thing' has in mind.