I want to change permission of each files in a directory. I've been used chmod 777 but its wasting time if I have 50 files. How to make all files inside directory become rwx without change them one by one.

link|improve this question

feedback

4 Answers

up vote 4 down vote accepted

chmod -cR 777 *

Will change all the files including subdirectories recursively (R option) including subdirectories, but also report on when it makes a change (c option).

Rather than changing all the files with too wide permissions, you might want to change the ownership instead.

sudo chown -hR tomcat

The line above changes owndership to a tomcat application server, you need to figure out which user your webserver is using. You can easily see that by doing

ps aux

(The h option is for changing the owndership of a symbolic link if encountered, but not the files it linkes to)

link|improve this answer
feedback

What you are doing is more than likely unsafe and the below command should only be invoked if you completely accept the security issues.

find . -type d -exec chmod 777 '{}'* \;

This will recursively go through the current directory and each subdirectory and change the permissions accordingly; if I haven't made it clear enough, this is a very bad idea (777 permissions)

link|improve this answer
feedback
chmod 777 *

will change all file in the current directory, but it's a bit strange that you need 777 permission. Are you sure of what you're doing ?

link|improve this answer
yah..because i'm just want 777 permission all images file.. – klox Jul 13 '10 at 5:25
6  
why do you want image files to be executable? – sunpech Jul 13 '10 at 5:30
feedback

Just type:

chmod 777 *
link|improve this answer
this won't work recursively – Nathan Fellman Jul 13 '10 at 18:12
The question didn't specify that it had to work on all subdirectories below the current one. – sunpech Jul 13 '10 at 19:03
feedback

Your Answer

 
or
required, but never shown

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