LinuxQuestions.org
Review your favorite Linux distribution.
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 01-17-2011, 08:58 PM   #1
kreed
LQ Newbie
 
Registered: Jan 2011
Posts: 7

Rep: Reputation: 0
Smile Setting up user to use sudo for specific commands


So I did some digging on the sudo command and I do know the config file is /etc/sudoers

Read the manual for sudoers and found out that I must use visudo to edit the file

I read some of the examples at the bottom of the file and tried entering my own account in following the example.

one of the commands I was trying to allow my account to perform without root login is the mount command

So I tried adding this in (kreid8 /bin/mount ALL)
I then saved & exited the file and logged out of root and tried sudo mount -t vfat /dev/sdc1 /media.

I got an error saying I had to be root in order to do that

But when I use the visudo -l option it shows that I have that privellege.

Did I edit the file incorrectly?

Thanks in advance to all those who reply with help
 
Old 01-17-2011, 09:40 PM   #2
smoothdog
LQ Newbie
 
Registered: Dec 2009
Posts: 8

Rep: Reputation: Disabled
Simple example

At a very simplistic level, you can add this to your /etc/sudoers file

user ALL=(root) NOPASSWD: /bin/mount

Where "user" is the user name. Additional commands can be added with commas

user ALL=(root) NOPASSWD: /bin/mount,/bin/umount

That should get you started anyway!
 
1 members found this post helpful.
Old 01-19-2011, 12:22 PM   #3
kreed
LQ Newbie
 
Registered: Jan 2011
Posts: 7

Original Poster
Rep: Reputation: 0
Great thanks a lot!!
 
Old 01-19-2011, 12:33 PM   #4
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655
Using the "user" or "users" mount option in /etc/fstab will also allow a regular user to mount that filesystem.
 
Old 01-19-2011, 12:45 PM   #5
kreed
LQ Newbie
 
Registered: Jan 2011
Posts: 7

Original Poster
Rep: Reputation: 0
I had to create another user and allow him to use sudo for my own account (kreid8)

So how would I go about doing that, because I do not want to give root commands to this user
I just want sudo tail and head to work from the new user using my account
 
Old 01-19-2011, 12:53 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,004
Blog Entries: 11

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Given the example above, and "man sudoers" you should be
able to figure that one out yourself, really ;}
 
Old 05-16-2011, 05:43 PM   #7
acraig
Member
 
Registered: Oct 2010
Distribution: Linux Mint 14 Nadia 32-bit, Pear Linux 6 32-bit
Posts: 113

Rep: Reputation: 6
Quote:
Originally Posted by kreed View Post
I had to create another user and allow him to use sudo for my own account (kreid8)

So how would I go about doing that, because I do not want to give root commands to this user
I just want sudo tail and head to work from the new user using my account

I had a problem with this when I set up my new Debian distro yesterday.
Here's what the bottom part of my sudoers file looks like:

# Uncomment to allow members of group sudo to not need a password
# %sudo ALL=NOPASSWD: ALL

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root ALL=(ALL) ALL
myusername ALL=NOPASSWD:ALL


To get to the file you should always use the command $ visudo

After (carefully) making the changes use ctrl+x then y to leave and when asked what to do type Q and hit enter. This will save the changes you made.

Test sudo with something simple. HTH.
 
  


Reply

Tags
sudo, sudoers


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] Allow commands without SUDO Touch Linux - Newbie 6 01-05-2011 09:33 AM
[SOLVED] trouble setting up sudo to allow su - user zrnaqvi Linux - Security 1 11-16-2009 07:42 PM
Displayign what user is running sudo commands jakev383 Linux - Security 1 08-04-2009 04:01 PM
Blocking mail to specific domain from specific user orko Linux - Server 0 03-26-2009 03:18 PM
How to force specific domain or user specific emails to proces in sendmail 8.13.5 FC5 peanutsa Linux - Newbie 1 03-22-2009 06:33 AM


All times are GMT -5. The time now is 11:28 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration