Talk to your host.
Also, I doubt you are using the correct port number imo.
Your host will also let you know what kind of handshake it expects in order to authorize the connection.
I have already setup the ssh key authentication and tested connecting from server1 to server2 and server2 to server1. Both servers are set with ssh to listen on port 22. I was wondering if wp-cli has an option to use the ssh key like standard ssh would.
Standard SSH:
ssh -i ~/.ssh/key user@server:22
wp-cli option?:
wp –ssh=-i ~/.ssh/key:user@server:22/var/www/html plugin update –all
wp –ssh=-i ~/.ssh/key:user@server:22/var/www/html theme update –all
(obviously this format failed, also using dummy data)
I’ve read the docs, and everything looks to me on your end :
https://make.wordpress.org/cli/handbook/guides/running-commands-remotely/#using-an-ssh-connection
> Is there a way for the 2 servers to authenticate using an SSH key?
I would still ask your host.
Using this approach :
http://www.linuxproblem.org/art_9.html
Or, is there a -u<username> option you can pass in like connecting with mysql so the username prompt does not come up ?
I found my answer here at the very bottom of the thread:
https://github.com/wp-cli/wp-cli/issues/2754
I had to setup a ~/.ssh/config to specify the IdentityFile and other connection information.
~/.ssh/config:
Host server
HostName 1.1.1.1
User user
Port 22
IdentityFile ~/.ssh/key
I could then run the command like so:
wp --ssh=server/var/www/html plugin update --all
Now the command can run without prompting for the remote servers users password.
So in conclustion, wp-cli doesn’t have a way to support ssh key auth, it would need to be configured on the server the command is executing on.