What user should I use for wp-cli on Ubuntu VPS [closed]

I think the error is very clear. The owner of public_html is www-data, you don’t have any permisson to write to that folder.

You can use whatever user you want as long as that user have permission to read, write and execute your DOCUMENT_ROOT folder. But you shouldn’t use root user.

So, to solve that error, try:

sudo chown -R `whoami`:www-data /var/www/example.com/public_html

That’s all 😉