The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



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

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-04-2001
Neko Neko is offline
Registered User
  
 

Join Date: Jun 2001
Posts: 3
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?
  #2 (permalink)  
Old 06-04-2001
alwayslearningunix
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
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

  #3 (permalink)  
Old 06-04-2001
Neko Neko is offline
Registered User
  
 

Join Date: Jun 2001
Posts: 3
Thank you very much


Thank you very much. That just saved me a tonne of work
  #4 (permalink)  
Old 06-04-2001
Optimus_P Optimus_P is offline Forum Advisor  
flim flam flamma jamma
  
 

Join Date: May 2001
Location: Chicago IL, USA
Posts: 1,006
wouldnt chmod -R 777 /home/domains/*

effectivly do the same things as

find /home/domains/*/ -type d -exec chmod 777 {} \;
??
  #5 (permalink)  
Old 06-05-2001
alwayslearningunix
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
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.
  #6 (permalink)  
Old 06-05-2001
Optimus_P Optimus_P is offline Forum Advisor  
flim flam flamma jamma
  
 

Join Date: May 2001
Location: Chicago IL, USA
Posts: 1,006
got ya.
  #7 (permalink)  
Old 07-12-2001
bizlink bizlink is offline
Registered User
  
 

Join Date: Jul 2001
Location: Orlando, FL
Posts: 1
Question New dedicated server and I'm a little confused

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
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:37 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0