LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 02-17-2010, 12:44 PM   #1
narnie
Member
 
Registered: Jan 2010
Distribution: Linux Mint, Ubuntu Netbook Edition, et al
Posts: 108

Rep: Reputation: 17
Remove need for sudo for mount/umount


Hello,

I'm trying to remove the need to use sudo to mount (in particular, binding).

Modifying /etc/sudoers using visudo, I have tried:
Code:
%admin ALL=NOPASSWD: /usr/bin/mount
%admin ALL=NOPASSWD: /usr/bin/umount
and
Code:
%admin ALL=(ALL) NOPASSWD: /usr/bin/mount
%admin ALL=(ALL) NOPASSWD: /usr/bin/umount
Both return

Code:
$ mount --bind /home/woodnt/Dir1 /home/woodnt/Dir2
mount: only root can do that
I have logged out and in (and even rebooted) to no avail.

What am I missing here?

With thanks,
Narnie
 
Old 02-17-2010, 01:00 PM   #2
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 281Reputation: 281Reputation: 281
I believe the sudo no password function still requires you to type sudo, it just doesn't ask you for a password. I believe what you want to do is create an entry in fstab with the users option.

http://ubuntuforums.org/showthread.php?t=81368

Last edited by pljvaldez; 02-17-2010 at 01:01 PM.
 
Old 02-17-2010, 01:00 PM   #3
reed9
Member
 
Registered: Jan 2009
Location: Boston, MA
Distribution: Arch Linux
Posts: 653

Rep: Reputation: 142Reputation: 142
Is mount/umount is /usr/bin? It's in /bin for me. What is the output of
Code:
which mount
EDIT: And the above is also true.
 
Old 02-17-2010, 01:03 PM   #4
reed9
Member
 
Registered: Jan 2009
Location: Boston, MA
Distribution: Arch Linux
Posts: 653

Rep: Reputation: 142Reputation: 142
I should think before posting. Assuming the path is correct, you can alias mount/umount to include sudo. Add something to ~/.bashrc like
Code:
alias mount="sudo mount"
if you want to avoid typing sudo.

You can also install pmount.
 
Old 02-17-2010, 11:27 PM   #5
narnie
Member
 
Registered: Jan 2010
Distribution: Linux Mint, Ubuntu Netbook Edition, et al
Posts: 108

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by pljvaldez View Post
I believe the sudo no password function still requires you to type sudo, it just doesn't ask you for a password. I believe what you want to do is create an entry in fstab with the users option.

http://ubuntuforums.org/showthread.php?t=81368
when I do this with truecrypt, it does not require the use of sudo before.

as in :

Code:
%admin ALL=NOPASSWD: /usr/bin/truecrypt
I don't need to run this with sudo:
Code:
$ truecrypt -t -v -d
Volume "/home/woodnt/.vol/xj9" has been dismounted.
Volume "/home/woodnt/.vol/i5yq" has been dismounted.
If I comment out the truecrypt line in /etc/sudoers, then truecrypt will run with asking for an admin password.

Truecrypt is likely calling for mount via sudo, but then why doesn't /etc/sudoers require mount to be the command not truecrypt?

As far as why mount and umount weren't working, it is because I was not careful.

I had it as /usr/bin/mount or umount unstead of /bin/mount and umount. Err. Stupid mistake!!!

Thanks,
Narnie
 
Old 02-18-2010, 01:07 AM   #6
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Quote:
Originally Posted by narnie View Post
I'm trying to remove the need to use sudo to mount
You don't want to use sudo? So why are you bothering to configure it?

You can give users permission to mount partitions by adding the "user" option to the relevant entries in /etc/fstab.

Evo2.
 
Old 02-18-2010, 06:55 AM   #7
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
Or as a complete alternative, you could look at pmount to allow normal users to mount. It doesn't require messing with sudo or fstab.
 
Old 02-19-2010, 08:03 PM   #8
narnie
Member
 
Registered: Jan 2010
Distribution: Linux Mint, Ubuntu Netbook Edition, et al
Posts: 108

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by evo2 View Post
You don't want to use sudo? So why are you bothering to configure it?

You can give users permission to mount partitions by adding the "user" option to the relevant entries in /etc/fstab.

Evo2.
Don't want them documented in fstab as they are encrypted volumes containing financial info, etc.
 
Old 02-19-2010, 08:06 PM   #9
narnie
Member
 
Registered: Jan 2010
Distribution: Linux Mint, Ubuntu Netbook Edition, et al
Posts: 108

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by Hangdog42 View Post
Or as a complete alternative, you could look at pmount to allow normal users to mount. It doesn't require messing with sudo or fstab.
I've actually thought about this, but haven't looked into seeing if I can get it to work with truecrypt. I'll have to delve into the truecrypt script and see how it mounts the volume (/dev/mapper/truecryptX), then mounts the unencrypted volume sometime. Just haven't had the time yet to get that deep into this. I also need to exam how compatable pmount is with mount. If it is a drop-in replacement, I can just do a simple search/replace (likely for "sudo mount") and repleace it with "pmount" but I'll check into this time permitting.

Does anyone know who we need to talk to to get a few more hours in every day? 26, or even 28 sounds good to me

Narnie
 
Old 02-19-2010, 08:20 PM   #10
fbsduser
Member
 
Registered: Oct 2009
Distribution: Hackintosh, SlackWare
Posts: 267

Rep: Reputation: 30
the reason truecrypt isn't requiring the use of sudo is likelly because the truecrypt "binary" is actually a script which runs sudo mount/sudo umount and a bunch of other libraries/binaries.
 
Old 02-20-2010, 07:18 AM   #11
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
Quote:
I also need to exam how compatable pmount is with mount. If it is a drop-in replacement, I can just do a simple search/replace (likely for "sudo mount") and repleace it with "pmount" but I'll check into this time permitting.
Pmount certainly doesn't replace mount on your system. I think of it more as an extension of mount. At least on my Slackware systems, there has been zero compatibility problems between pmount and mount.
 
Old 02-24-2010, 12:57 AM   #12
narnie
Member
 
Registered: Jan 2010
Distribution: Linux Mint, Ubuntu Netbook Edition, et al
Posts: 108

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by Hangdog42 View Post
Pmount certainly doesn't replace mount on your system. I think of it more as an extension of mount. At least on my Slackware systems, there has been zero compatibility problems between pmount and mount.
Good to know. Perhaps I shouldn't have used the phrase "drop in replacement" as I did, as I didn't mean that it means mount is uninstalled, but that it is command compatable in that if I were to search/replace a script for mount (replacing with pmount) and it would work, then it would work just the same.

I haven't installed pmount, but would get this answer if I would do that and read the man pages. Just hadn't had the time to experiment on this particular issue (so many irons in the fire)
 
  


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
Execute command on mount and integrate with gnome-mount / umount Peter Rhone Linux - Newbie 4 11-18-2008 05:28 AM
util-linux-2.12r error on 'make -C mount mount umount' james penguin Linux From Scratch 2 08-28-2006 11:55 PM
FSTAB: My Win Share Wont Mount @ Boot, but will when I sudo mount -a...please help! TruANTOlogy Ubuntu 8 06-20-2006 08:00 AM
mount/umount devit Linux - General 4 02-19-2004 12:37 PM
mount and umount wr3ck3d Linux - Newbie 4 12-14-2002 04:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 09:22 PM.

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