Solved: root is not allowed to run sudo on ngelinux. This incident will be reported.
In this post, we will see one of the common error while using sudo and how to fix that.
I. Problem
[root@ngelinux bin]# sudo -u mysqld sh /monitor/mysqld/scripts/mysqld_NGEL.sh root is not allowed to run sudo on ngelinux. This incident will be reported.
II. Solution
1. Check sudo path and its permissions. [root@ngelinux bin]# which sudo /usr/bin/sudo [root@ngelinux bin]# ls -l /usr/bin/sudo ---s--x--x 1 root root 165488 Oct 19 2021 /usr/bin/sudo 2. Check sudoers file permissions also [root@ngelinux bin]# ls -l /etc/sudoers -r--r----- 1 root root 4332 Aug 24 20:55 /etc/sudoers [root@ngelinux bin]# 3. Make sure to have root entry in the file like below. ## the root user, without needing the root password. ## Allow root to run any commands anywhere root ALL=(ALL:ALL) ALL ## cdrom as root [root@ngelinux bin]#
Once you make the required entry and have correct permissions, then sudo with root should work.
If still its not working, then please check nsswitch.conf file which sudo is referred, sometimes ldap provides the sudo file and causes such issues.