I'm trying to set up a WordPress site on a LAMP stack on Debian 6.0. From the WordPress documentation (and my experience on shared hosts) the correct permissions should be as follows

All files should be owned by your user account, and should be writable by you. Any file that needs write access from WordPress should be group-owned by the user account used by the webserver.

I've managed to setup my server to have 755 permissions on all directories and 644 on all files. However, WordPress is still not able to create folders for uploads and upgrades. I'm guessing that this is because WordPress is not running as my user account, but as www-data and therefore it needs group write permissions.

How do I make WordPress run as my account? Or am I on the wrong track?

I'm new to this, having outgrown shared hosting and setting up my first VPS. I would really appreciate it if you could answer in as much detail as possible.

  • 1
    Try chmod g+w on a folder you know for sure it needs access to and see if that helps, if so, switch permissions to have group writing on those folders. Or if you really want to go 'per-user access', you can always apt-get install apache2-mpm-itk and configure your workdpress vhost with exactly the uid/gid you need.
    – O G
    Commented Aug 16, 2011 at 14:52
  • Thanks for pointing me at apache2-mpm-itk, that got it to work :)
    – blogjunkie
    Commented Aug 16, 2011 at 16:45

1 Answer 1


Many of the examples assume you're not the only person running stuff on the server, or that suPHP or some other utility is running to make PHP run as a user other than the web server.

With a basic Debian LAMP install, where PHP runs as the www-data user, it's safe and normal to set ownership of everything under the web server document root directory as owned by www-data:www-data with permissions 700/600 or 770/660.

The only issue then is when you (as a user) want to put files into those directories, in which case you either need to add yourself to the www-data group (and use the second set of permissions above) or do it via sudo or as root, and remember to set the permissions later.

Personally, now that Wordpress can auto-update and auto-install plugins and themes, I just set everything to www-data:www-data and let Wordpress handle it, works fine.

The walkthroughs that talk about setting permissions to your username assume PHP is running as you, through as I say, some other extension or Apache mod.

  • That makes sense. I did think about that but was uncomfortable with what I thought were 'loose' permissions. I wish I had known this earlier coz I spent the last few hours enabling apache2-mpm-itk for my server.
    – blogjunkie
    Commented Aug 16, 2011 at 16:44
  • Worst case is that someone breaks into the web server and can write to the /var/www directory, or run PHP5 as the www-data user. But that user doesn't have rights anywhere else on the server - the problem is caused when you have two customers with websites, one gets hacked, and the hackers can deface everything because they're all owned by www-data. That's why people separate. Commented Aug 16, 2011 at 17:13
  • Thanks, that won't be a problem since it's not a shared environment
    – blogjunkie
    Commented Aug 17, 2011 at 3:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.