Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Ive got a website (run on Ubuntu Server) that needs to modify and delete files, every now and again it comes across a file that it needs to run "chmod" on in order to perform it's operations.

However it seems as tho the 'www' user does not have permission to run 'chmod' on any files.

So I'm looking for the command to allow the 'www' user to do its thing on files inside the /var/www folder and also the /var/logs folder for example.

Thanks.

share|improve this question
    
Who owns these files, and why? It'd be a useless rights concept if any user could give himself permissions to other users' files. Please explain your situation more. –  Daniel Beck Apr 5 '12 at 10:48
    
The directory is owned by user 1000 (me) and in group 33, the files inside are owned by user 33 and in group 33. –  Derrick Apr 5 '12 at 11:02
add comment

1 Answer

chown can (usually) only be used by the super user (root). To chmod a file, I think you need to be the owner of the file (or be the super user).

To circumvent the restrictions, you could simple always use sudo to change the access modes or ownership.

But, most likely, you don't want to give global sudo rights to your www user.
This is where /etc/sudoers comes into play. Due to higher powers in play I can't work out an example for you right now.
So, for now, the man page for sudoers has to suffice.

I wouldn't recommend doing it anyway. If there are files that need to be manipulated, make sure they're created with proper access rights for your task to complete or somehow redesign the process to circumvent the issue.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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