I want to make a shell that sends command which runs at sudo level, from a system to multiple system.

for example:

for system in ${systems[@]}; do
    ssh $system "echo 'password' | sudo -S yum -y update python" > /dev/null > 2>&1 &

So the system that runs the shell will make other servers do the yum update. Every system has the same sudo password.

But the password here is a plain text. If I hash the password, it doesn't work since every system has different hash.

Question :
I want to hash a password in a shell that sends ssh command to other systems. How?

  • 2
    Use certificate based authentication to log in as root and avoid the issue entirely
    – roaima
    Mar 25, 2021 at 7:56
  • I have certs. Still needs password since the shell doesn't run with root. It must be run at sudoer level because of SSO and SAC.
    – Lunartist
    Mar 25, 2021 at 8:01
  • You should really consider using something like Ansible for things like these.
    – Kusalananda
    Mar 25, 2021 at 8:03
  • I really want to use Ansible, too. AWX is already installed, but I can't use it for the time being.
    – Lunartist
    Mar 25, 2021 at 8:04
  • Is yum -y update python the only automated command your account needs to run as root?
    – roaima
    Mar 25, 2021 at 13:27


You must log in to answer this question.

Browse other questions tagged .