How to sshpass ssh-copy-id?

PythonEnthusiast picture PythonEnthusiast · Aug 9, 2015 · Viewed 8.5k times · Source

I dont want to keep typing the passwords again and again, hence want to provide it into the command itself. How can I do it?

Currently, I'm doing like this

sshpass -p server_password port_number ssh-copy-id user@IP

It says,

sshpass: Failed to run command: No such file or directory

Where am I going wrong? I found the net, and it was given the same.

Answer

Ghasem Pahlavan picture Ghasem Pahlavan · Aug 9, 2015

You must specify port_number like this:

sshpass -p server_password ssh-copy-id user@IP -p port_number