i am running a command from my server which would remotely ssh to by client machine as root and sudo as olcne user and run few commands for validation. I have added the olcne user in sudoer list. i am able to locally execute these commands without any issue through sudo but when executed remotely i am getting the below error
Apr 18 06:28:02 client sudo: olcne : user NOT authorized on host ; TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/etc/olcne/scripts/olcne-firewall-check 2379 tcp Apr 18 06:28:03 client sudo: olcne : user NOT authorized on host ; TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/etc/olcne/scripts/olcne-image-exists container-registry.oracle.com/olcne/kube-scheduler:v1.14.8 sudoer file root ALL=(ALL) NOPASSWD: ALL olcne ALL=(ALL) NOPASSWD: ALL ## Read drop-in files from /etc/sudoers.d (the # here does not mean a comment) #includedir /etc/sudoers.d cat /etc/sudoers.d/olcne Cmnd_Alias OLCNE_PRIVILEGE = \ /etc/olcne/scripts/ olcne ALL=(root:ANY) NOPASSWD: OLCNE_PRIVILEGE
Running the command from the client is success.
[root@client var]# sudo su olcne -c "sudo /etc/olcne/scripts/olcne-firewall-check 8472 udp" yes