Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have an account named as Chankey (local user). I had to use some commands like viewing the shadow file etc. I tried it using sudo command

sudo vim /etc/shadow

It said:

Chankey is not in the sudoers file. This incident will be reported.

How can I add this user Chankey to the sudoers file?

share|improve this question
add comment

1 Answer

up vote 10 down vote accepted

You need to have root access to add a user to the sudoers file. So either

su - root

(and put the root password in) and then use

visudo

as root to make the relevant and correct changes, or ask your sysadmin.

You usually want something like,

username    ALL=(ALL) ALL

or,

%groupname  ALL=(ALL) ALL

and put your user ID into that group, but how you configure sudo depends on the standards for your environment.

Changing the sudo config file should only ever be done with visudo (to prevent being locked out by making a bad change), and it should only be done by someone who understands how to configure sudo safely (personal soapbox: sudo is not the tool some people think it is).

share|improve this answer
    
+1 for using visudo done that once. Painful mistake. :) –  chrisjlee Dec 26 '12 at 21:43
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.