Created
April 17, 2017 08:06
-
-
Save zh4n7wm/7343d2c1b8c99652847052c874c787a7 to your computer and use it in GitHub Desktop.
sudo: sorry, you must have a tty to run sudo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for x in $(cat hosts) | |
do | |
echo $x && ssh -t $x 'sudo grep -Pq "^\s*Defaults:centos\s+!requiretty\s*$" /etc/sudoers || sudo sed -i "/Defaults requiretty/a \ | |
Defaults:centos !requiretty" /etc/sudoers ; exit' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment