-
Assign Wordpress (/var/www/wordpress) folder to web server user (www-data)
sudo chown -R www-data:www-data /var/www/wordpress
-
Find your wp-cli installation
which wp
-
Add user (mylinuxuser) to visudo with web server user permissions (www-data)
3.1 Open visudo
sudo visudo
3.2 Specify the permissions you want to give to your user by adding the following line
mylinuxuser ALL=(www-data) NOPASSWD: /usr/local/bin/wp
-
Create an alias so that wp cli always uses web server credentials
4.1 Open your bash_aliases file
nano ~/.bash_aliases4.2 Create an alias for wp so that it always executes with web server user by adding the following line
alias wp="sudo -u www-data wp"
-
Enjoy seamless wp updates from cli and web browser.
Last active
January 5, 2018 18:12
-
-
Save akkys77/4e1046739b37fb3ac0474464aaaef117 to your computer and use it in GitHub Desktop.
Setup WordPress wp cli to avoid linux permission issues between cli and browser
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment