LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Regarding sudoers file (https://www.linuxquestions.org/questions/linux-newbie-8/regarding-sudoers-file-836053/)

Ajit Gunge 10-04-2010 04:37 AM

Regarding sudoers file
 
Hi All,
How do I add a user in a sudoers file.
There is this specific command that I want to run and the error is as below.

Quote:

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

[sudo] password for ajit:
ajit is not in the sudoers file. This incident will be reported.

-A option not allowed for root!
and the command doesnt run.Can some one tell me what am i missing over here.

Regards!
Ajit

Wim Sturkenboom 10-04-2010 04:55 AM

Code:

[sudo] password for ajit:
ajit is not in the sudoers file. This incident will be reported.

I guess it's what the message says.

If you don't have permission to modify the sudoers file, you can't modify it anyway.

Ajit Gunge 10-04-2010 05:00 AM

:newbie:
 
I want to know how to modify the file.I am running hte command using the root login.

prayag_pjs 10-04-2010 05:03 AM

hi you need to login as root

using

Quote:

su -
Then as root open file

Quote:

visudo
Add the line given below
Quote:

ajit ALL=(ALL) NOPASSWD: ALL

Once you are added as sudoer Logout from root terminal

and as ajit user do this

Quote:

sudo <root-privileges-command>

sem007 10-04-2010 05:08 AM

Quote:

Originally Posted by Ajit Gunge (Post 4117006)
There is this specific command that I want to run and the error is as below.

open /etc/sudoers file as root and add give specific command's privilege to user ajit.

vi /etc/sudoers

Code:

ajit ALL = (ALL) /full/path/of/command
Regards,

Wim Sturkenboom 10-04-2010 09:44 AM

Quote:

Originally Posted by sem007 (Post 4117035)
vi /etc/sudoers

Better to use visudo instead of vi; from the man page

Code:

visudo edits the sudoers file in a safe fashion, analogous to vipw(8).
visudo locks the sudoers file against multiple simultaneous edits, pro‐
vides basic sanity checks, and checks for parse errors.  If the sudoers
file is currently being edited you will receive a message to try again
later.


bsat 10-05-2010 12:38 AM

in future you can avoid this by giving the new user you create admin privileges or adding him to the "root" group.


All times are GMT -5. The time now is 08:14 AM.