• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

Archives for November 2018

Revised WordPress Permissions

November 23, 2018

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 {} \;

$ 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 {} \;

$ 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');

$ 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

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

That should take care of everything.

Filed Under: Misc

Using the Gutenberg Editor

November 22, 2018

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

Filed Under: Misc

200MB USB Drive

November 19, 2018

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.

Filed Under: Misc Tagged With: format, usb

Python: 16:9 Aspect Ratio

November 15, 2018

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("===================================================")
print("This program will calculate a video's aspect ratio.")
print("===================================================")
 
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("")
	print("The video aspect ratio is: {:.0f} x {:.0f}".format(video_width, video_height))
	print("")
 
elif height_or_width == "w":
	video_width = float(input("Enter a video width in px: "))
	video_height = video_width / 1.7777777777777
	print("")
	print("The video aspect ratio is: {:.0f} x {:.0f}".format(video_width, video_height))
	print("")
 
else:
	print('Thanks for playing .... ')
	print('')

import math print("===================================================") print("This program will calculate a video's aspect ratio.") print("===================================================") 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("") print("The video aspect ratio is: {:.0f} x {:.0f}".format(video_width, video_height)) print("") elif height_or_width == "w": video_width = float(input("Enter a video width in px: ")) video_height = video_width / 1.7777777777777 print("") print("The video aspect ratio is: {:.0f} x {:.0f}".format(video_width, video_height)) print("") else: print('Thanks for playing .... ') print('')

The output:

Filed Under: Linux Tagged With: aspect ratio, python, video

Learning Python

November 7, 2018

I decided to start learning another programming language. Python! Reading up with some docs now.

By the way, Python 2.7 is already installed on the recent Mac OS. If you have Mavericks or a later OS, you’re good.

Filed Under: Cloud, Mac Tagged With: python

Remote Desktop Sharing on Mac

November 7, 2018

If you have 2 Macs, you can get to the other one by using Screen Sharing. Just go System Preferences > Sharing > Remote Management. From there you can choose the type of access the remote user will have. You can also limit it to just one user or allow all if you have multiple users.

To access the desktop from a remote desktop, just open up a Safari browser and enter in the URL box: vnc://192.168.1.222. Substitute the IP Address of the remote desktop that you want to control remotely. I works on Chrome as well. Wished I did this earlier.

There’s no need to purchase any software. They’re already in the OS.

Filed Under: Mac Tagged With: remote sharing, vnc

LightSail Manage Databases

November 1, 2018

Amazon Web Services is now offering managed databases in LightSail.

If you have a small website or just want to develop something quickly, it might be worth a try creating a simple database in LightSail.

Filed Under: Cloud Tagged With: databases, lightsail

  • Home
  • About
  • Archives

Copyright © 2023