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 -


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 -