LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 07-08-2010, 03:29 PM   #1
sasser
Member
 
Registered: Apr 2010
Location: Bucharest
Distribution: Slackware13.37, OpenBSD5.1, FreeBSD9.0
Posts: 40

Rep: Reputation: 0
sudo: umount works, mount not works


Hello,

I've got a problem in doing sudo working for mounting things (e.g. usb pen or optic discs). Details:

The OS: Slackware 13.0

The response to sudo -l command:
Code:
User user1 may run the following commands on this host:
    (root) /sbin/shutdown -h now, /sbin/shutdown -r now
    (root) /usr/bin/less /var/log/syslog
    (root) /sbin/mount /dev/sda?, /sbin/umount /dev/sda?
    (root) /sbin/mount /dev/hdc, /sbin/umount /dev/hdc
The first two (shutdown and reading the syslog) works as sudo, but the problem appears when I try to mount an usb memstick or an cd/dvd disc. In my case, sda (sda1) is the memstick in /dev, which I can mount as root using su, mount /dev/sda1 /media/usb.

When I try to mount it using sudo mount /dev/sda1 /media/usb, doesn't work, I get the response:
Code:
Sorry, user user1 is not allowed to execute '/bin/mount /dev/sda1 /media/usb' as root on HOST1.
Firstly, I don't understand why the OS thinks user1 wants to execute /bin/mount when in sudoers is /sbin/mount.

If I use the full path sudo /sbin/mount /dev/sda1 /media/usb, still doesn't work:
Code:
Sorry, user user1 is not allowed to execute '/sbin/mount /dev/sda1 /media/usb' as root on HOST1.
Here user1 is not allowed to execute /sbin/mount as root, why? According to sudo -l should have this privilege.

But after I mount the /dev/sda1 using su, I can umount it using sudo umount /dev/sda1

What's wrong? Why the umount works and mount doesn't?

Thanks.
 
Old 07-08-2010, 03:51 PM   #2
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Lower Rhine region, Germany
Distribution: Slackware64 14.2 and current, SlackwareARM current
Posts: 1,646

Rep: Reputation: 147Reputation: 147
Quote:
Originally Posted by sasser View Post
Hello,

I've got a problem in doing sudo working for mounting things (e.g. usb pen or optic discs). Details:

The OS: Slackware 13.0

The response to sudo -l command:
Code:
User user1 may run the following commands on this host:
    (root) /sbin/shutdown -h now, /sbin/shutdown -r now
    (root) /usr/bin/less /var/log/syslog
    (root) /sbin/mount /dev/sda?, /sbin/umount /dev/sda?
    (root) /sbin/mount /dev/hdc, /sbin/umount /dev/hdc
The first two (shutdown and reading the syslog) works as sudo, but the problem appears when I try to mount an usb memstick or an cd/dvd disc. In my case, sda (sda1) is the memstick in /dev, which I can mount as root using su, mount /dev/sda1 /media/usb.

When I try to mount it using sudo mount /dev/sda1 /media/usb, doesn't work, I get the response:
Code:
Sorry, user user1 is not allowed to execute '/bin/mount /dev/sda1 /media/usb' as root on HOST1.
Firstly, I don't understand why the OS thinks user1 wants to execute /bin/mount when in sudoers is /sbin/mount.

If I use the full path sudo /sbin/mount /dev/sda1 /media/usb, still doesn't work:
Code:
Sorry, user user1 is not allowed to execute '/sbin/mount /dev/sda1 /media/usb' as root on HOST1.
Here user1 is not allowed to execute /sbin/mount as root, why? According to sudo -l should have this privilege.

But after I mount the /dev/sda1 using su, I can umount it using sudo umount /dev/sda1

What's wrong? Why the umount works and mount doesn't?

Thanks.
As far as I know you have to type the commands exactly as they are used on the command line, in your example you are missing the last part, the mount point! Guess it will work if you try in your sudoers file "/sbin/mount /dev/sda1 /media/usb" instead or use wildcards like "/sbin/mount /dev/sda1 *".
 
Old 07-08-2010, 05:42 PM   #3
DonnieP
Member
 
Registered: Jan 2008
Location: Richmond, VA USA
Distribution: Slackware
Posts: 144

Rep: Reputation: 29
Quote:
Firstly, I don't understand why the OS thinks user1 wants to execute /bin/mount when in sudoers is /sbin/mount.
Because /sbin is not in user1's path; you need to add it.
 
Old 07-09-2010, 03:01 AM   #4
sasser
Member
 
Registered: Apr 2010
Location: Bucharest
Distribution: Slackware13.37, OpenBSD5.1, FreeBSD9.0
Posts: 40

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by titopoquito View Post
As far as I know you have to type the commands exactly as they are used on the command line, in your example you are missing the last part, the mount point! Guess it will work if you try in your sudoers file "/sbin/mount /dev/sda1 /media/usb" instead or use wildcards like "/sbin/mount /dev/sda1 *".
Yes, it worked, thanks.

Now I understand why the umount had worked and mount didn't in my initial setup.
 
  


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
Remove need for sudo for mount/umount narnie Linux - Security 11 02-24-2010 12:57 AM
"sudo mount -a" works perfect but permission denied when mounting on startup, why? aaron4katie Linux - Software 10 01-11-2007 10:16 AM
su works but sudo doesn't work. magnum81 Ubuntu 2 04-22-2006 10:52 PM
su to root works sudo doesn't magnum81 Linux - Security 4 04-22-2006 08:29 PM
XAWTV works, videodog works, motion works but how to code my own? rylan76 Linux - Hardware 0 01-06-2006 06:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 12:00 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