Files
Bash_Scrips/Man_tool/change_pass.sh
2025-06-23 21:19:51 +02:00

20 lines
314 B
Bash
Executable File

#!/bin/bash
#scrpit to change root password from a csv file
#<hostname>,<passwd>
if [ $# -lt 1 ]
then
echo "Syntax: ./$(basename $0) <file name>"
exit
fi
for csv in $(cat $1)
do
HOST=$(echo $csv |cut -d "," -f1)
PASS=$(echo $csv |cut -d "," -f2)
ssh ansible@$HOST "echo root:$PASS |sudo chpasswd"
done