views:

36

answers:

3

Hi

i am new to linux platform and now i wanted to remove write permissions of all the php files under my root folder. It would be appreciable if somebody can suggest a solution.

thanks and regards

tismon

+2  A: 
find / -name '*.php' -exec chmod a-w {} \;
Matthieu
before you do that, you can also use 'find /root -name *.php -print' (remove the quotes) to see what files it will change permissions to. Also, you'll probably want to use sudo to run that command with root permissions.
Matthieu
Thanks for the reply but i am afraid to say that the command is not working with my system (RHEL 5). It would be helpful if you could provide an alternate option.
tismon
You have to put the \*.php in quotes like this: find / -name "\*.php" -exec chmod a-w {} \;
fschmitt
On my system it works fine without quotes...
Matthieu
A: 

An alternate option would be to use these 2 commands

cd /
chmod -R a-w *.php

But I also recommend (like Matthieu did) to have a look first, what files you are really modifying.

tombom
A: 

This will work:

find /root -type f -name "*php" | xargs chmod 664
flaab