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!
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.
Add the option 'user' to the /etc/fstab line for the device you want users to mount, for instance I allow user mounting of the CD so I have
/dev/cdroms/cdrom0 /mnt/cdrom iso9660 noauto,ro,user,exec 0 0
See the man page for mount 'cos the option 'user' implies other options you may wish to override, eg noexec in the above example.
That bit says that the process should run under the owners user id. So in this case, when executed by a common user, /bin/mount will get root privileges. As root do
chmod a+rx,u+ws /bin/mount
That is, read and execute permissions for all users, write permissions and SUID for the owner.
While we're on the subject, I have tried this method to allow a Samba share to be mounted from an ordinary user account. The line in /etc/fstab reads:
//<IP address>/<share name> /media/Mac smbfs uid=****,gid=***,noauto,users 0 0 edited to remove IP address & IDs, for reasons of paranoia
I know that the entry is valid, as it allows me to mount the share simply with mount /media/Mac. However, I can still only do this by suing as root. Is this due to the fact that (as I understand it) mount -t smbfs... calls smbmnt rather than performing the mount directly? Does anyone know a way around this?
It is possible if the user attempting to mount the smbfs owns the mount point directory and has rwx permissions on it. From the look of smbmnt.c, this is as good as it gets. Group ids are not checked, so I don't know how you might have a common directory to which all users mount the share.
A word of note, with the `users' option another user could unmount the share from under your nose. Instead I would suggest the `user' option. However, smbmnt does not write the mounting user to /etc/mtab so only root can unmount the share with the umount command, therefore use smbumount as a user to unmount the smbfs and this way only the mounting user can unmount again.
Thanks for the advice, Joubert. I changed the ownership of the directory in which the share was mounted. It still insisted, however, that smbmnt needed to have the suid bit set. I guess I need to make a decision between ease and the additional risks involved in this.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.