Article 4YC0C How to run root level command...

How to run root level command...

by
albrechtmyers
from LinuxQuestions.org on (#4YC0C)
I am looking t run root level command on multiple servers, but all servers have only "su - " permission available in sudoers.
please help me if any way that I can run command using help of "su -"

My script

Code:
Code:for hosts in `cat hosts.txt`;
do
echo "###########################Server Name- $hosts ----Ruinng script-Please Wait--- Please wait###########################"
ssh -q -t abc@$hosts sudo -S <<< "abc" systemctl restart crond
doneError----------
[sudo] password for abc:
Sorry, user abc is not allowed to execute 'systemctl restart crond' as root on xyz.domain1.com

[abc@localhost ~]$ sudo -l
(root) NOPASSWD: /bin/su -latest?d=yIl2AUoC8zA latest?i=eOxHyIEnZN0:yFuearXBVvQ:F7zBnMy latest?i=eOxHyIEnZN0:yFuearXBVvQ:V_sGLiP latest?d=qj6IDK7rITs latest?i=eOxHyIEnZN0:yFuearXBVvQ:gIN9vFweOxHyIEnZN0
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments