#!/bin/bash
user="your_username" # 替换为你的用户名
key_path="$HOME/.ssh/id_rsa.pub" # 替换为你的公钥路径
 
for (( i=1; i<=100; i++ ))
do
  host="host$i" # 替换为你的主机名
  echo "Attempting to copy key to $user@$host"
  ssh-copy-id -i $key_path $user@$host
done