0

I am trying to loop through a list of remote servers, ssh to them and get hardware info, but this requires sudo password, and I don't want to have to type in password for each loop, and unsure how to accomplish that. My script below:

#!/bin/bash

for i in $(cat server-list.txt); do 
    ssh -t username@${i} 'sudo -s <dmidecode -t 1>';
done

Note: all system commands require sudo password.

Kara
  • 6,115
  • 16
  • 50
  • 57
ghenzi83
  • 109
  • 1
  • 13

0 Answers0