LinuxQuestions.org
Visit Jeremy's Blog.
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-09-2004, 06:48 AM   #1
rob19
Member
 
Registered: Mar 2003
Location: New Zealand
Distribution: Red Hat Linux 8 & 9
Posts: 32

Rep: Reputation: 15
Using chmod on directories


If I FTP a complete website directory to my RH9 Linux server with subdirectories and files, the permissions are such that everyone gets an error when trying to view the pages.

I fixed this by using chmod as follows:

chmod -vR a=rx,u+w mynewdirectory


This works but it means that everything is executable. Ideally, I would like to just make the directories executable not the files. How? Anybody know?


I was also wondering if there was a way to set the default permissions for files and directories that are FTPed.
 
Old 07-09-2004, 07:34 AM   #2
arobic
Member
 
Registered: Jul 2003
Location: Geneva, Switzerland
Distribution: Debian 3.1, SLC3 (based on RHEL)
Posts: 84

Rep: Reputation: 15
Hi!

Unfortunately, there is no simple way to do that since chmod doesn't have a "directory only" option.

You may be interested to read this:
http://lists.debian.org/debian-user/.../msg05215.html

and the reply!

My idea would be to use the -p option in ls and then grep the / at the end of directories like that:
ls -p | grep /

to get a list of the directories, put this into a file and write a shell script to chmod the element in the list. There probably is a more efficient way to do it, but that's what I would do!

Hope this helps!
 
Old 07-09-2004, 07:06 PM   #3
rob19
Member
 
Registered: Mar 2003
Location: New Zealand
Distribution: Red Hat Linux 8 & 9
Posts: 32

Original Poster
Rep: Reputation: 15
Thanks arobic,

I will give that a try. It makes sense to me in theory too but I thought there may have been a simple way.


I thought that umask would be the command I needed to set the default permissions but when I FTP files over it doesn't apply those settings. The settings in umask seem to only apply if the user creates new files on the server directly. Am I missing something with umask here? Incase setting default file permissions is dependant upon the FTP program, I am running vsftpd on the server (and I am very happy with it).
 
Old 07-09-2004, 08:45 PM   #4
Berhanie
Senior Member
 
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
suppose you downloaded the site into your /mirror directory. then, to give all directories under /mirror execute permissions, you would do
Code:
 find /mirror/ -type d -exec chmod a+x {} \;
 
Old 07-10-2004, 05:37 AM   #5
rob19
Member
 
Registered: Mar 2003
Location: New Zealand
Distribution: Red Hat Linux 8 & 9
Posts: 32

Original Poster
Rep: Reputation: 15
Berhanie,

That is a great fix. I can tidy up permissions with two simple lines now and only my directories are executable.

Pity nobody knows how to set default FTP permissions but I am not complaining.

Thanks again.
 
  


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
CHMOD directories.sub-directories.files zerojosh Linux - Software 2 11-19-2005 04:22 PM
chmod to only change directories lluciano Linux - General 2 08-17-2005 03:14 PM
How to chmod -R on directories only? jdupre Linux - Newbie 3 11-13-2004 12:45 AM
chmod directories only vrillusions Linux - General 4 05-21-2003 09:02 PM
Cannot Chmod directories stelmed Slackware 4 05-19-2003 02:30 PM


All times are GMT -5. The time now is 08:34 PM.

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