xwp / wp-cli-ssh

[OBSOLETE] Seamlessly run WP-CLI commands on a remote server via SSH
157 stars 14 forks source link

sudo - How do "pros" use wp-cli? #16

Closed szepeviktor closed 10 years ago

szepeviktor commented 10 years ago

Good morning! I have several small vps-s with separate users for apache mpm-itk. They are not real persons just separate linux user WITHOUT passwords to secure virtual hosts. Do "pros" have one user for all sites? Or have one site per server?

So I'd like to use sudo after ssh-ing to the remote system. How is it possible? Thank you!!

In wplib I this line to start wp-cli

sudo -u "$WPOWNER" -- /bin/bash -c "cd \"$WPROOT\"; wp \"\$@\"" wp "$@"

https://github.com/szepeviktor/wplib/blob/master/share/wplib/wp-libwp.sh#L87

szepeviktor commented 10 years ago

Put sudo in the YAML file, in the cmd option?

westonruter commented 10 years ago

@szepeviktor perhaps:

ssh:
  staging:
    cmd: ssh %pseudotty% util.example.com sudo %cmd%

I have not tried this, however.

szepeviktor commented 10 years ago

Thank you!