I would like to use ssh key authentication. I have a file that contains:
ip location
ip location
etc
i have a bash script as follow :
declare -A mylist
declare -A myarray
i=1
while read line ; do
mylist[$i]=$(echo $line | awk '{print $1}')
myarray[$i]=$(echo $line | awk '{print $2}')
((i++))
done <file.conf
for ip in "${mylist[@]}"; do
for location in "${myarray[@]}" ; do
ssh ${ip} tail -f ${location} > /home/log_${ip} 2>/dev/null &
done
done
When i do this it asks me for password all the time.I have no idea how to generate a key can you please show me the steps.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…