My web server uses the user www-data to access/change files. This causes permission issues for php file upload etc. for files owned by root (or by any other user).

I'd like to use the 755/644 permissions for my folders/files (rather than 775/664), so I'd like to actually change the owner of the files to www-data, rather than just the group.

I don't want to run in to the situation where the root user can't access/modify the files though.

I'm sure this is basic knowledge for most people, but I just wanted to double-check it. If I change the owner:group of a file to www-data:www-data, will the root user still be able to edit/access the files? Would the root user be able to change it back to root:root if desired?

  • 2
    Fun experiment: do chmod a-rwx on a file. Then open it as root. – muru Jan 9 '15 at 19:33

In most situations (read default installations), root can do anything a regular user can and much more. If you think root cannot do something, remember it can become a user who can :)

You'll be fine.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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