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.
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.