wp-deploy-flow icon indicating copy to clipboard operation
wp-deploy-flow copied to clipboard

Connect to ssh using public/private key

Open sushicodeur opened this issue 10 years ago • 3 comments

Hello,

I'm accessing my staging environment using public/private key authentication and an alias in my ~/.ssh/config file. Thus, accessing my staging server with ssh is only done like this :

ssh my-staging

I installed this plugin, it works in --dry-run mode, but in live mode, I'm asked for a password that is not my key passphrase.

It looks like the rsync command is issued like that : rsync -avz -e 'ssh -p 22' @my-staging:/path (etc)

I modified puller.php to add @ mark only if $ssh_user is set which works better with this setup. Before I submit a pull request, is there another way to handle this kind of ssh authentication that I haven't found yet ?

Btw, many thanks for this plugin that is exactly what I wanted to do :)

Alain

sushicodeur avatar Jul 04 '14 08:07 sushicodeur

Hi, sshing without specifying a username takes as default username your current, local account. So if you're logged in on your local computer as sushicodeur, it's the same as ssh sushicodeur@my-staging

Therefore, you must set 'sushicodeur' as the $ssh_user in your deployment config.

demental avatar Jul 04 '14 09:07 demental

Well, that's true, I can use the user that is defined in my alias, thanks for your reply.

In fact I'm used to connect just by specifying the alias name, like "ssh my-staging" and the user is taken in the alias definition :

Host my-staging
  Hostname ssh.myhost.com
  User mysshuser
  IdentitiesOnly yes
  IdentityFile ~/.ssh/mykey.id_rsa

If I use "ssh @my-staging" then it overrides the alias user with my system login and doesn't works.

But no problem, I'll connect with "ssh mysshuser@my-staging" instead.

sushicodeur avatar Jul 04 '14 09:07 sushicodeur

Fine, you still can submit a PR with this, this makes sense . FYI I'm not using wp-deploy-flow anymore (I'm not using wp anymore), so this project is kind of abandoned..:/

demental avatar Jul 04 '14 09:07 demental