Ssh-copy-id in one line with password, possible

ansiblefreebsdsshssh-keys

I'm trying to setup an automated script in Ansible to set a new server, and i'm using ssh-copy-id to add the Ansible master server to the new server's authorized ssh keys.

I created a script which uses ssh-copy-id, but that command is asking for the new server's password.

Is it possible to give it that password in the same line of calling it so i can automate it in a script?

Best Answer

Yes, you can do it with a loop using expect.