This document assumes that your system has chosen the "public_html" directory as the default directory to contain HTML documents. If you don't know for sure what it is on your system, try the "public_html" one first, create a simple HTML document, and try it out. If it didn't find one, ask your system administrator or someone who might know.
From time to time, I run into the occasional curious HTML newbie about setting up a homepage on his/her account. Others try to go about setting one up themselves, and quite successfully, I might add. However, the way they have set up their account can be dangerous.
For example, someone had created the directory of "public_html" with access of read-execute globally. This is partially correct (I'll explain more later). However, the files within the "public_html" directory were globally read and write. This is NOT a good thing! This allows anyone on the system the ability to change that file, even if the directory isn't set up for global write.
Now, I said that having the public_html directory read-execute globally is partially correct. Ideally, you don't want anyone access to anything in your directory, so you want to create the directory for execute only. If you have a special CGI program that you don't want anyone on the system gaining access to, this is the best way to prevent anyone from "borrowing" it. It doesn't do much for HTML files since they can view the source via the browser.
Now, how to go about correctly setting up your account for HTML. I'll be using my home directory for the example, just replace my information with yours. To find out where your located on your system, finger your
account while you're on-line. It'll tell you something like "
First, you need to go to the directory above your account. For me, that would be "
/u2/". Get there by typing
Then, you have to chmod (change mode) your account. Enter
chmod 701 tomcat
If you want to know what that means, type "
man chmod" at the Unix prompt, it'll tell ya.
chmod 701 sets up your account with full privilages for yourself, but
only executable access for anyone else, including WWW access.
Okay, after that, go back to your directory. Do this by typing in "cd
tomcat". Now, we have to chmod the public_html directory. "
chmod 711 public_html" will take care of that for us.
Now, the files within the "public_html" differ as far as access attributes.
Any HTML files (with the .html extension) are to be chmod'ed to "604".
For example. "chmod 604 index.html". If you have any CGI's, they need to be
"chmod 705 index.cgi". If you create any directories within the
"public_html" directory, chmod those to 755 ("
chmod 755 cgi-bin"), and then
chmod the files in that directory accordingly. If you must have a file with
global read-write, then "
chmod 606 temp" is necessary.
And you can do this safely because no one can gain access to any of your files, anywhere in your directory
, provided you did everything right up to this point.
Check your files!! If you don't know what to look for, here's an idea.
-------------------------------------------------------------- -rw----r-- 1 tomcat users 1597 Jan 9 08:35 combat.html -rw----r-- 1 tomcat users 919 Dec 27 08:45 feedback.html -rw----r-- 1 tomcat users 1354 Jan 1 00:28 guest.html -rw----r-- 1 tomcat users 12908 Jan 10 00:31 index.html -rw----r-x 1 tomcat users 500 Dec 25 20:00 test.cgi* ^^^^^^^^^^-These are the file attributes. Most of your files should look like this."chmod 604" sets the attributes to -rw----r--
I hope this helps some people, and I hope it also catches some of those files out there that ARE global read-write. :)
IF YOU ARE THOROUGHLY CONFUSED, THEN DON'T DO ANYTHING. I'm not gonna take any responsibility if you screw up on your account. Like I said, "use at your own risk". It's not hard, but you can goof things up if you don't know what you're doing.
Remember, substitute anything like "
/u2/tomcat" with your appropriate information.