![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| "find command" to find the files in the current directories but not in the "subdir" | swamymns | Shell Programming and Scripting | 9 | 07-22-2008 11:23 AM |
| grep to find content in between curly braces, "{" and "}," | keshav_rk | Shell Programming and Scripting | 4 | 08-09-2007 10:14 PM |
| bash: cd command to access "strange" directories | robotronic | Shell Programming and Scripting | 3 | 07-06-2007 04:35 PM |
| Listing only directories in the current working directory using the "ls" command | igandu | UNIX for Dummies Questions & Answers | 2 | 05-12-2006 04:47 AM |
| How to find out the exact year in "Last modified time" using ls command | Dophlinne | UNIX for Dummies Questions & Answers | 6 | 04-11-2006 11:07 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
chmod 777 on all directories below...how do I do that using the "find" command?
I've got 100 directories that each have 2 directories with in them.
Structered like this: /home/domains/domain1/ through to /home/domains/domain100/ and those 2 directories mentioned above are here: /home/domains/domain1/directory1/ /home/domains/domain1/directory2/ through to /home/domains/domain100/directory1/ /home/domains/domain100/directory2/ I need to chmod 777 on /directory1/ and /directory2/ How can I do this really quickly using the find command? I had to chmod 755 on .cgi files in those directories and I did that using this command: find . -name "*.cgi" -exec chmod 755 {} \; How do I modify that command to chmod 777 on all directories but not the files in those directories? |
|
||||
|
It's clear the "domain" directory is not a universal name and so it's hard to use one find command to chmod all the directories under these "domain" directories - I am presuming you don't want the actual "domain" directories chmodded?
If there are no other directories, other than the ones you wish to operate the chmod command on, in /home/domains you can issue this command: find /home/domains/*/ -type d -exec chmod 777 {} \; Which will chmod all the directories under all the directories under /home/domains/domains1-100 - if you get what I mean ![]() Another way to do it is to make a file which contains all the directory names under /home/domains under which you want the directories chmodded - which you may have if this is a commercial hosting service (an administration file of users/domain names would contain this information). Put that file in the directory from which you can then issue this command on the command line; filelist=the file with the list of directories [cr] = carriage return: for x in `cat filelist` [cr] do [cr] find /home/domains/$x/ -type d -exec chmod 777 {} \; [cr] done [cr] Hope this helps. Regards |
|
||||
|
chmod -R /home/domains/* would recursively change the permissions on everything underneath the stated path name. Neko only wanted to change the permissions on the directories under the path name he stated. Thus the find command allows us to specify a condition (-type d) on which to operate the chmod command, which will only affect directories, not files.
Regards. |
|
||||
|
I am not entirely new to unix or telnet....but advanced would
be a huge stretch of the imagination..... I am trying to chmod a directory via root and I'm getting a no such file or directory message? correct me if I'm wrong but you simple go to the directory you want to change permissions on and run this command, chmod -r 777 Tony |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|