• This may not be the right forum, but I didn’t see anyplace else that seems appropriate for system administrative questions pertaining to WP CLI.

    I have several shared hosting servers that are built on CloudLinux and WHM/cPanel and the user accounts do not have shell access. I also have a script that allows me to quickly install WordPress on a user account, but it is pretty raw and could be vastly improved with WP CLI. I login via SSH with EC key pairs, and there is an external gateway/firewall in front of the servers that allows port 22 only from specific administrative IP addresses. So my administrative user is the root user. I currently run my script as root.

    The wp command throws up a strong warning about running as root. It suggest I use the command sudo -u USER -i -- wp <command> instead. To do so I would have to enable jailed user shells for all users. Due to a feature in CloudLinux called Link traversal protection and the way it manages chroot filesystems between users, doing so forces you to choose between two bad options, both of which I would like to avoid.

    Running instead as sudo -u USER wp <command> allows it to run without the interactive user shell and it will then work without having to enable jailed user shells for all users. The users exist, but by dropping the -i switch and the double hyphen I am not requiring an interactive login shell.

    So what are the consequences of using the wp command without the interactive login shell. Will using sudo -u USER wp <command> instead of sudo -u USER -i -- wp <command> break anything?

    Thank you.

Viewing 1 replies (of 1 total)
  • This is more of a server/groups/user question imo.
    However, I’ve certainly never been able to sudo before, so you’re already ahead of the game!

    I can’t see how the switch between using the -i paramter vs. not using it would make any difference. WordPress itself certainly should not care. Your user needs access to the wp cli – that’s pretty much it.

    Obviously, just test it all first and compare results:
    https://make.ww.wp.xz.cn/cli/handbook/guides/commands-cookbook/

Viewing 1 replies (of 1 total)

The topic ‘Using WP CLI on CloudLinux/cPanel server without shell’ is closed to new replies.