What are the best or most ideal Linux Permissions for WordPress

Hello Support, I’m not sure if this is the best place to put this question (if not please move it), but I’m hoping that someone is able to provide some guidance on the best practices when using WordPress on an ubuntu linux server.

I currently have several websites on a single VPS server running Ubuntu 14.

Currently all the permissions are set to user www-data and group www-data, with folder permissions are 755 and file permissions set as 644.

I am wanting to change the user to something other than www-data, as an example: myuser

So all WordPress files and folders will have the permissions of myuser:www-data

Doing this with WordPress is easy enough, however since this is WordPress as far as I can see I then need to alter the permissions for specific wordpress files / folder to make sure the user can access / write to them.

This is what I have so far…

1	find /var/www/mywebsite.com/wp-content/uploads -type d -exec sudo chmod 775 {} ;
2 find /var/www/mywebsite.com/wp-content/upgrade -type d -exec sudo chmod 775 {} ;
3 find /var/www/mywebsite.com/wp-content/themes -type d -exec sudo chmod 775 {} ;
4 find /var/www/mywebsite.com/wp-content/plugins -type d -exec sudo chmod 775 {} ;
5  
6 find /var/www/mywebsite.com/wp-content/uploads -type f -exec sudo chmod 664 {} ;
7 find /var/www/mywebsite.com/wp-content/upgrade -type f -exec sudo chmod 664 {} ;
8 find /var/www/mywebsite.com/wp-content/themes -type f -exec sudo chmod 664 {} ;
9 find /var/www/mywebsite.com/wp-content/plugins -type f -exec sudo chmod 664 {} ;

From here, everything looks great until I try to upload an image through WordPress, and I receive a

HTTP Error

So, I make the group writeable, g+w and everything works as it should.

I then come to automatically update my plugins and it is now asking for FTP information. This is where I am now lost.

I’ve tried search online for the best solution, or the most appropriate permission setup for WordPress on linux when wanting to change the user from www-data to something different, and though there are many articles are there, I’ve come up short as to what is the best practice for wordpress, and making sure the site works as it does when using www-data as the user.

Any help or advice would be very much appreciated, and any guidance on using different user, while keeping my sites secure.

Many thanks,

Kriss