chmod and chgrp on user linux account

Dear Experts,

Now I would like to open my VPS site to visitor. Before doing that, I need to
set all my directories and files to be read only (including download file from visitors).
And I know if don't put any index.html or inde.php at the directories, it will
show  the directories content such as file tress on browser. How to not to read the file trees by visitor.

Is there any existing linux script doing for ALL  change the read mode with my user group for all
file and directories  and its sub-directoried
under my VPS user account directory when visitors visit my site and the script  meets the requirement mentioned above ?  SO I need to take use
chgrp besides chmod command in the script.

For uploading file from visitors, do I need to set write and read for the uploading directory
in my server, how  ?

Please advise

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

the easiest way when you do not have a security concept is to login by ftp on your server to set the permissions and to test. you can use for example.

The security concept is user group anyone means the first number is the permission for users the second for the group and the last for every one normally you should set 750. So you can still have full access the group normally the apache group has only read execute and anonymous 0

You can read how to do:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
If I'm reading correctly, I believe you just need to use the -R option to chgrp and chmod to change it for all subdirectories.

Change the group to your home folder and everything under.
chgrp -R My_Group ~

Remove write permissions from the group and other in your home folder and everything under
chmod -R g-w,o-w ~
rwniceingAuthor Commented:
g-w  and o-w is equal to 744 or something else ?

how to not to show file directories tree on browser  if the index.php or inde.html is not existing on
those directories ? For example, when you type http://, , it will show the
directory  or file tress on browser since there is no any index file.
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

It's subtracting the w or write from group and other without changing the other permission bits.

It could be 755 or 744 or 711 or 700, depending on what you had before.

What do you mean exactly?  Do you want to disable directory listing?  Then you remove the read bit but leave the execute bit for the directory.  The files should still have the read bit.  Set the directory to 711 but leave the files with 744.  If you have scripts, you may need to set those files to 755.  That's why you use the g-w, o-w options to only remove the write bit.
You can chroot their sftp account. Or FTP account... as you prefer. No need to change permissions.
rwniceingAuthor Commented:
Thanks for your reply
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.