I am using below shell script for linux machines
#!/bin/bash
for ip in `cat /root/ip`; do
# ssh-copy-id -i ~/.ssh/id_rsa.pub $ip
sshpass -p "test" ssh-copy-id -i ~/.ssh/id_rsa.pub $ip
done
But for esxi ssh key path is different.
cat ~/.ssh/id_rsa.pub | ssh root@machineip 'cat >> /etc/ssh/keys-root/authorized_keys
Please help in esxi script