Saturday 18 October 2014

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

Part of my testing, there are many best practices in hardening the server and part of it are not to allow "root" access via SSH. As root is common username for a Linux/Unix based system. So I decided to create a user and give it root privileges as I wanted to have complete access of the server. However we can provide limited access to user we want to create.

[root@linux ~]# useradd newuser
[root@linux ~]# passwd newuser
Changing password for user newuser.
New password: "enterpassword"
Retype new password:"enterpassword"
after creating the user when you try to sudo and use command you will face following error "newuser is not in the sudoers file.  This incident will be reported"
[root@linux ~]# su newuser
[ammar@panel root]$ sudo -s
[sudo] password for newuser:
ammar is not in the sudoers file. This incident will be reported.
go to 
[root@panel ~]# nano /etc/sudoers
add following line:
newuser   ALL=(ALL)       ALL      (note: this will grant all privileges to user newuser 

Hope it helps !

No comments:

Post a Comment