LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 05-16-2013, 05:42 AM   #1
Seb Spiers
LQ Newbie
 
Registered: Mar 2012
Location: Worcester, UK
Distribution: Fedora, CentOS
Posts: 18

Rep: Reputation: Disabled
Question Allow non-root users to mount cifs shares


Hi There,

I want to allow a handful of my users to mount cifs shares to directories they create within their home drives.

When they try to mount them currently theyre advised that only root can mount.

How can enable specific users to use the mount command without giving them root level privileges?
 
Old 05-16-2013, 08:42 AM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
This is a perfect case for the use of sudo. Create a new group and add the users that should be able to use mount, then configure sudo so that this group can use mopunt with sudo.
For example, if the group you created is called mounters the entry in your sudoers file should look like:
Code:
%mounters ALL=/sbin/mount
 
Old 05-16-2013, 08:45 AM   #3
Seb Spiers
LQ Newbie
 
Registered: Mar 2012
Location: Worcester, UK
Distribution: Fedora, CentOS
Posts: 18

Original Poster
Rep: Reputation: Disabled
So how would they then go about mounting the share? Just normally using the mount command?
 
Old 05-16-2013, 09:26 AM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
It would be something like
Code:
sudo mount -t cifs //server/share /mountpoint
I also forgot that you have of course to add umount to the sudoers file, otherwise your users wouldn't be able to unmount the shares.
 
Old 05-16-2013, 09:34 AM   #5
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,420

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
Or you can do like this with username, password and domainname,

Code:
# mount -t cifs //server-name/share-name /mnt/<directory_name> -o username=<shareuser>,password=<sharepassword>,domain=<domainname>
 
Old 05-16-2013, 09:34 AM   #6
Seb Spiers
LQ Newbie
 
Registered: Mar 2012
Location: Worcester, UK
Distribution: Fedora, CentOS
Posts: 18

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TobiSGD View Post
It would be something like
Code:
sudo mount -t cifs //server/share /mountpoint
I also forgot that you have of course to add umount to the sudoers file, otherwise your users wouldn't be able to unmount the shares.
I tried this but it didn't work... I added ALL to sudoers and then it worked but I don't want another root account!
I wonder if my mount isnt /sbin/mount ... is that possible?!?!?
 
Old 05-16-2013, 11:40 AM   #7
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Quote:
Originally Posted by Seb Spiers View Post
I wonder if my mount isnt /sbin/mount ... is that possible?!?!?
Maybe, on my Slackware systems it is /sbin/mount, I just looked at a Debian system and there it is /bin/mount. You can find out where it is on your system with
Code:
which mount
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mount Openfiler NAS CIFS shares on windows clients using script in a domain. How to? linuxlover.chaitanya General 1 08-02-2010 04:55 AM
Using cifs to mount domain-windows shares with kerberos. (krb5) munta LinuxQuestions.org Member Success Stories 1 01-29-2010 06:14 AM
CIFS Shares mount problem havok1977 Linux - Software 3 06-12-2007 12:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration