LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-16-2001, 10:22 AM   #1
Ricardo77uk
Member
 
Registered: Jun 2001
Location: London England
Distribution: Suse 7.1
Posts: 45

Rep: Reputation: 15
Question permissions?


I was wondering what command line would be used to change the permissions of a directory and all its files/subdirectories to 755.

i used chown but had no luck....


Thanks
 
Old 07-16-2001, 10:54 AM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 235Reputation: 235Reputation: 235
it would be something like this:
Code:
chmod 755 /filename-here
man chmod for more details and options for doing all subdirectories... can't remember off the top of my head at the moment.
 
Old 07-16-2001, 11:05 AM   #3
jharris
Senior Member
 
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243

Rep: Reputation: 46
Is this to make files available for your web server? If so you might want to have a look at a little Perl script that I use... It will chmod your files and dirs, 711 for dirs, 755 for cgi files and 644 for the rest.

Code:
#!/usr/local/bin/perl -w
# A little program to chmod all files to in the current directory and
# sub-directories to public readable and executable as necessary.  All
# directories are set to 711, this EXCLUDES the current directory (.),
# all .cgi, .class, .prl file are changed to 755, all remaining files are
# changed to 644.

use File::Find;

@ARGV = ('.') unless @ARGV;

find(\&process_file, @ARGV);

sub process_file {

   if ( -d ) {
     chmod 0711, "$_";
     print("chmod'ed $_/ to 711\n");
     return;
   }

   if ( /\.cgi$|\.prl$|\.class$|\.pl/i ) {
     chmod 0755, "$_"; 
     print("chmod'ed $_ to 755\n");
   }
   else {
     chmod 0644, "$_" ;
     print("chmod'ed $_ to 644\n");
   }
}
HTH

Jamie...

PS Damn the forum double spacing the code makes it look bad! (in Opera)

Last edited by jharris; 07-16-2001 at 11:14 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
file permissions OK, but command permissions? stabu Linux - General 2 10-05-2005 01:00 PM
permission ... permissions .... permissions alaios Linux - General 1 05-31-2005 05:16 AM
Permissions jymmi Linux - Newbie 3 04-15-2005 12:43 AM
Permissions help reddog64 Linux - Newbie 1 04-22-2004 06:23 PM
getting a directory's permissions and creating a new one with the same permissions newbie1000101 Programming 1 04-10-2004 01:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration