Copy my ssh key to remote machine via ssh-copy-id in a script without prompt?
I believe you can use sshpass.
- Ubuntu/Debian:
apt-get install sshpass
- Fedora/CentOS:
yum install sshpass
For example:
sshpass -p "PASSWORD" ssh-copy-id -o StrictHostKeyChecking=no USERNAME@IP