Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

A folder under the directory /var/www/xml keeps changing permission from www-data toroot, meaning that no php file is able to write into the folder.

I think this happens when I restart the server.

drwxr-xr-x 6 root www-data 4096 Sep 10 13:40 xml

drwxr-xr-x 6 www-data www-data 4096 Sep 10 13:40 xml

How do I make sure this does not happen?

share|improve this question
add comment

2 Answers 2

up vote 0 down vote accepted

Are you the only person with root / sudo access to this server? If not, it is possible that someone else is changing the permissions and not notifying you.

Another thought would be a cron job that runs as the root user and issues a chown on that directory for whatever reason, e.g. such as after processing an xml feed file.

share|improve this answer
    
It seems to happen when I upload new files to the folder, I did the following so that all file permission in the folder are changed to www-data chown www-data -R xml but this makes no difference for newly uploaded files, is there a fix around this? –  mk_89 Sep 10 '12 at 18:05
    
How are you uploading new files (e.g. wget, scp, ftp, etc) and as what user? –  KayakJim Sep 12 '12 at 15:31
    
Im using SFTP . –  mk_89 Sep 12 '12 at 16:49
    
What user are you logging in as for your SFTP session? I'm guessing it is the root user, which is a very bad idea, but if so that would explain why the owner gets changed to the user that uploaded the file. –  KayakJim Sep 12 '12 at 21:38
    
it is the root user –  mk_89 Sep 12 '12 at 22:41
show 1 more comment

Find out what changes the permission of the folder and fix it.

auditd can help.

share|improve this answer
    
He's asking how. –  adaptr Sep 10 '12 at 12:53
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.