Bootstrap FreeKB - Linux Commands - Resolve "Sorry, user is not allowed to execute as root"
Linux Commands - Resolve "Sorry, user is not allowed to execute as root"

Updated:   |  Linux Commands articles

Let's say you try to do something using sudo.

[john.doe@server1]# sudo /usr/local/scripts/example.sh

 

And something like this is being returned.

Sorry, user john.doe is not allowed to execute '/usr/local/scripts/example.sh' as root on server1.example.com.

 

Almost always, this simply means that the user (john.doe in this example) has not been granted sudo permission to the command being issue (/usr/local/scripts/example.sh in this example).

Check out my articles

For example, perhaps the /etc/sudoers file does not contain a line like this, granting john.doe sudo permission to run /usr/local/scripts/example.sh.

john.doe ALL=(ALL:ALL) NOPASSWD: /usr/local/scripts/example.sh

 

Let's say the /etc/sudoers file contains the following, granting member of the admins group sudo permission to run /usr/local/scripts/example.sh.

%admins ALL=(ALL:ALL) NOPASSWD: /usr/local/scripts/example.sh

 

In this scenario, perhaps john.doe is not a member of the admins group.

~]$ groups john.doe
john.doe users

 

I also once had this issue after I used the Red Hat LEAPP utility to migrate a server from Red Hat 7 to Red Hat 8 and I had to reload the system daemons for some reason.

[root@server1 ~]# systemctl reload-daemons

 

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 73ce09 in the box below so that we can be sure you are a human.