first commit
This commit is contained in:
19
Man_tool/change_pass.sh
Executable file
19
Man_tool/change_pass.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/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
|
Reference in New Issue
Block a user