Categories
Ubuntu Wordmove WordPress

WordPress directory and file ownership and permissions

Is WordPress failing to upload, install, or update your plugins, themes, or media files? It’s possible that your directory and file permissions are not set correctly.

chown

The chown command allows you to change user and group ownership for files and directories.

Recursively change user and group ownership of all directories and files to www-data:www-data, from the current directory.

sudo chown -R www-data:www-data . 

chmod

The chmod command changes the access permissions for files and directories.

Recursively change all directory and file permissions from the current directory.

sudo . -type d -exec chmod 755 {} \;  
sudo . -type f -exec chmod 644 {} \; 

wordmove

If you are updating WordPress via wordmove, you may wish to update all directory and file permissions automatically by setting rsync_options in your movefile.yml

 ssh:
    host: YOUR_HOST
    rsync_options: '-og --chown=www-data:www-data --no-perms --chmod=ugo=rwX'
Categories
Ubuntu WordPress wp-cli

Delete image sizes from WordPress

Easily delete images sizes from the command line.
This is permanent!

 find wp-content/uploads/*  -iname '*-2000x750.*' -exec rm {} \;
Categories
Ubuntu

Users

List all users
getent passwd {1000..60000}

Categories
Ubuntu

Ubuntu update

apt update && apt upgrade -y && apt dist-upgrade -y && apt autoremove -y

Categories
Ubuntu

System restart

lists the packages that requested the reboot
cat /var/run/reboot-required.pkgs

Restart server. Takes 10 seconds or more.
sudo reboot

Categories
Ubuntu

Ubuntu bin directories

~/bin 				# you
/usr/local/bin			# you and other local users
/usr/local/sbin			# root only
/bin				# system