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?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
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).
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0