Setting permissions for wordpress

Everyone experiencing this issue should execute these commands:

sudo usermod -aG www-data $USER

Adds the currently logged in user to the www-data group.

sudo chown -R www-data:www-data /var/www

Changes the ownership of the /var/www directory to www-data group.

sudo chmod -R 755 /var/www

If this doesn’t fix the issue you’re having, you’ve got something else wrong and bashing DO is not going to help anyone. If you want a managed server, look for hosting elsewhere. If you need help, ask someone or hire an admin that knows how to not only ‘set things up’ but knows how to secure your server as well. You’ll be glad you did. DO is not for novices, even if they have a lot of tutorials.

Upgrade the distribution

Apt is a monster of a tool. It can help you stay right on the cutting edge with little or no effort on your part.

Let’s say, for example, you’ve had an Ubuntu installation running for a while, but you want to install the latest version of the OS. You need to do a full backup, burn a new disc, sit through a reinstallation process and cross your fingers, right? Wrong.


sudo apt-get distupgrade

to bring your installed distro in line with current standards automatically.

Perform package upgrades

The next step is to turn your installed packages into the shiny new versions, which you can do using a slightly different command in the terminal window:

sudo apt-get upgrade 

Insert it (remembering to prefix it with sudo, which tells Ubuntu to perform the action as a super user) and apt-get will hammer through the list, marking and installing any packages that have fallen behind the times.

Manually update packages

The auto-updater isn’t the only way to get your system up to speed. The package manager – which deals with downloading, installing and configuring new programs – might need a little kick, however.

Open a terminal window (select it from the menu, or hit [Alt]+[F2] and type gnome-terminal), then type

sudo apt-get update

to ensure that Ubuntu’s knowledge of packages is up to date.

How to Stop WordPress Asking for FTP details to Upgrade Plugins

There are a couple of ways to get rid of the FTP Connection Information form.

The first method will likely only work if you have your own dedicated or private server with root ssh access.

For 99.9% of shared hosting, you are unlikely to have the privileges required to muck around with the web server settings and that is what’s needed.  If this is you, jump to the quick fix.

For this first method, we’re going to find out which user owns the web server and give that user ownership of your WordPress installation.

We’re assuming you’ve got a Linux box running Apache as the web server as that’s the most popular hosting plan type.

Login to your server box using ssh.

Find out what user is running the web server by typing:

ps aux | grep ‘apache’

The command will return something similar to this:

root@ubuntu-box:/# ps aux | grep ‘apache’
root 1933 0.0 2.3 44900 12032 ? Ss Aug25 15:09 /usr/sbin/apache2 -k start
webuser 2572 0.0 6.2 66468 30246 ? S Mar10 0:04 /usr/sbin/apache2 -k start
webuser 6045 0.0 6.4 66884 31562 ? S Mar10 0:07 /usr/sbin/apache2 -k start
webuser 6786 0.0 5.6 64156 27632 ? S Mar10 0:10 /usr/sbin/apache2 -k start

This tells you that the web server is running under the user webuser.

You can now give that user recursive ownership (all subfolders) of your WordPress installation using the command:

chown -hR webuser:webuser /var/
sudo chown -R www-data:username /var/www

Replacing webuser with whatever user is running your Apache server and the last part with the direct path to your root WordPress installation folder.

Note: Some chown versions are different.  Type chown –help to get info on your version.

The Quick Fix

Ok, so you’re on a typical shared hosting plan and just want this damned FTP Connection Information form to go away.

Here’s what to do.

Edit your wp-config.php file (found in the root of the WordPress installation) and add the following lines somewhere in between the start :
[pre]/** Setup FTP Details **/
define(“FTP_HOST”, “localhost”);
define(“FTP_USER”, “your-ftp-username”);
define(“FTP_PASS”, “your-ftp-password”);[/pre]
Replacing the values with whatever you use on the FTP Connection Information form.

Once saved and uploaded if making the changed from a local copy, you should no longer be prompted for FTP Connection Information.

CSR Generation: Using OpenSSL (Apache w/mod_ssl, NGINX, OS X)

A CSR is a file containing your certificate application information, including your Public Key. Generate your CSR and then copy and paste the CSR file into the web form in the enrollment process:

Generate keys and certificate:

To generate a pair of private key and public Certificate Signing Request (CSR) for a webserver, “server”, use the following command :

openssl req -nodes -newkey rsa:2048 -keyout myserver.key -out server.csr

This creates a two files. The file myserver.key contains a private key; do not disclose this file to anyone. Carefully protect the private key.

In particular, be sure to backup the private key, as there is no means to recover it should it be lost. The private key is used as input in the command to generate a Certificate Signing Request (CSR).

You will now be asked to enter details to be entered into your CSR.

What you are about to enter is what is called a Distinguished Name or a DN.

For some fields there will be a default value, If you enter ‘.’, the field will be left blank.

Country Name (2 letter code) [AU]: GB
State or Province Name (full name) [Some-State]: Yorks
Locality Name (eg, city) []: York
Organization Name (eg, company) [Internet Widgits Pty Ltd]: MyCompany Ltd
Organizational Unit Name (eg, section) []: IT
Common Name (eg, YOUR name) []:
Email Address []:

Please enter the following ‘extra’ attributes to be sent with your certificate request

A challenge password []: 
An optional company name []:

Use the name of the web-server as Common Name (CN). If the domain name (Common Name) is append the domain to the hostname (use the fully qualified domain name).

The fields email address, optional company name and challenge password can be left blank for a webserver certificate.

Your CSR will now have been created. Open the server.csr in a text editor and copy and paste the contents into the online enrollment form when requested.

Alternatively one may issue the following command to generate a CSR:

openssl req -nodes -newkey rsa:2048 -nodes -keyout myserver.key -out server.csr 
-subj "/C=GB/ST=Yorks/L=York/O=MyCompany Ltd./OU=IT/"

Note: If the “-nodes” is entered the key will not be encrypted with a DES pass phrase.