I am trying to copy my ssh keys to all the hosts which my script reads from a list, ssh to them and run some yum install
commands:
while read f; do
ssh-copy-id -f myusername@"$f"
ssh myusername@"$f" '
yum install -y epel-release
wget --no-check-certificate https://packages.icinga.org/epel/7/release/noarch/icinga-rpm-release-7-1.el7.centos.noarch.rpm
sudo -n yum install -y icinga-rpm-release-7-1.el7.centos.noarch.rpm
yum install -y icinga2 nagios-plugins-all
rm -rf /etc/icinga2/conf.d/*
rm -f /etc/icinga2/zones.conf
I get an error:
sudo: a password is required
bash: line 7: /etc/icinga2/zones.conf: Permission denied
If I add -i (sudo -i
) then I will get:
sudo: no tty present and no askpass program specified
bash: line 7: /etc/icinga2/zones.conf: Permission denied
Can you please help?
Thanks