Revised WordPress Permissions

Here’s my revised WordPress permissions. Originally, I had it set to:

$ sudo chown -R www-data:www-data /var/www
$ find /var/www -type d -exec sudo chmod 755 {} \;
$ find /var/www -type f -exec sudo chmod 644 {} \;

This is a very safe setup as recommended by quite a few WordPress security gurus.

However, here’s the issue. When you try to FTP as “ulysses” user, it won’t let you overwrite files, because it doesn’t have write access to the “/var/www” directory since it’s owned by www-data. To fix the permission issue, first you have to add the “ulysses” user to the www-data group. See below. In addition, you’ll need to change ownership of the files and directories to the “ulysses” user and give “ulysses” user full access to the files. Change file permissions to 775, and directory permissions to 664.

$ sudo usermod -a -G www-data ulysses
$ sudo chown -R ulysses:www-data /var/www
$ find /var/www -type d -exec sudo chmod 775 {} \;
$ find /var/www -type f -exec sudo chmod 664 {} \;

Everything is all and good, until you try to add a plugin within the WordPress console. It’s now asking for your FTP credentials which most people don’t have setup. The simple fix here is to the following line in your wp-config.php file. 

$ vi /var/www/html/wp-config.php
# Add the following ...
define('FS_METHOD', 'direct');

While you are at it, you should also change wp-config.php permissions to 660. Some people recommend 600, but then you’ll end up with the same permission issue as before, user “ulysses” will not have access to the wp-config.php file. So 660 is the preferred value.

$ sudo chmod 660 /var/www/html/wp-config.php

That should take care of everything.

Using the Gutenberg Editor

Beginning with WordPress 5, Gutenberg will be part of the WordPress core. If you want a preview, install it as a plugin. What is Gutenberg? 

The Gutenberg WordPress editor is a new page builder that is being designed to integrate with WordPress core. Gutenberg will add content blocks and page builder-like functionality to every up-to-date WordPress website. When in use, it will replace TinyMCE as the default content editor. With Gutenberg, content is added in blocks of various types from the WordPress backend. This is a quote block.

From: iThemes 

This is numerical list.

  1. Hello
  2. Goodbye

200MB USB Drive

I have a 8GB USB drive that displays only as 200MB. I have to run diskpart as an Administrator from my Windows 10 computer. I selected the disk, and then cleaned it. After that, go back to disk management, and then reformat the entire partition to FAT32. USB drive is now showing 7.9GB.

Here’s the fix.

Python: 16:9 Aspect Ratio

Just playing around with Python. This program a simple calculation of a video’s 16:9 aspect ratio.

Just supply the width or height in pixels, it will display the 16:9 resolution.

Here’s the code.

import math
print("This program will calculate a video's aspect ratio.")
height_or_width = input('Choose a height or width (h, w) to calculate? ')
if height_or_width == "h":
	video_height = float(input("Enter a video height in px: "))
	video_width = video_height * 1.7777777777777
	print("The video aspect ratio is: {:.0f} x {:.0f}".format(video_width, video_height))
elif height_or_width == "w":
	video_width = float(input("Enter a video width in px: "))
	video_height = video_width / 1.7777777777777
	print("The video aspect ratio is: {:.0f} x {:.0f}".format(video_width, video_height))
	print('Thanks for playing .... ')

The output: