LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Using chmod on directories (https://www.linuxquestions.org/questions/linux-newbie-8/using-chmod-on-directories-202971/)

rob19 07-09-2004 05:48 AM

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.

arobic 07-09-2004 06:34 AM

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!

rob19 07-09-2004 06:06 PM

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).

Berhanie 07-09-2004 07:45 PM

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 {} \;

rob19 07-10-2004 04:37 AM

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.


All times are GMT -5. The time now is 07:59 PM.