www.ntnu.no *
INFOWEB >  developement and programming >  web development  > Create homepage on stud
Verktøy
Du kan legge til kommentarer
Eller sende denne artikkelen
Les artikler skrevet av skolmli
Brukervurdering
Hvor mye hjelp var det i denne artikkelen?
Mye Noe Lite
Forhåndsvisning
Du trenger ikke en 'utskriftsvennlig side' for å skrive ut denne siden. Forklaring
Innhold

How to create a homepage on "stud"

About the public_html folder and the Q: drive

Your student account on the NTNU servers consist of two parts; your private folder, where all your private files are stored, and the web folder, where you can make your files available for others through the WWW.

In the public computer labs these folders will automatically be mounted to M: (private files) and Q: (WWW) on login. This is also the case for most of the institute labs.

The web folder is not stored on the same drive as your private files. They are stored on a completely different server, but for historical reasons we have made a symbolic link from your private folder to your www-folder. This link will appear on the M:-drive as a folder called "public_html". Storing data in the "public_html" folder is not the same as storing data on Q: - To ensure files get proper access permissions, always use Q:

To see what is meant by "symbolic link", you can log on to login.stud.ntnu.no. Once logged on to the computer through ssh, writing the command ls -al will give information concerning the "public_html"-folder looking somewhat like this

konsoll #1
lrwxrwxrwx   1 root     bin       27 Jun 26  1999 public_html ->/local/www.stud/users/username/

The "l" in the string "lrwxrwxrwx" shows us that this is a symbolic link. This output also shows us that the link is pointed towards the folder /local/www.stud/users/brukernavn/

NB!If you delete the public_html folder, you can not recreate the symbolic link by simply making a folder named "public_html". This folder would function as a regular folder on your private storage area, and the files stored in it would not be accessible through the WWW. If you by accident delete the symlink, you can restore it by using the command ln -s /local/www.stud/users/username public_html when logged on to login.stud.ntnu.no. Replace "username" with your private username.

Permissions

The files stored in your web folder are only available online if the reading permissions are set correctly. If you store the files on Q:, the permissions will be set automatically. If you store the files in the public_html-folder, you have to manually set the reading permissions of the files. If you don't change the permissions, the files will not be available on the www. You then get an "access denied" or "permission denied"-message when trying to access the files through your web browser.

Permissions are mainly set in UNIX ( e.g. via ssh).

Changing permissions in UNIX

Permissions can be changed with numeric codes or with letter combinations. Either way, the command to use is chmod

Changing permissions with numbers

Example : chmod 755 filename

This is the most commonly used command for making files available on the www. The first number in the code defines your personal privileges, the second number the privileges of other users in your group (usually all the users in your faculty), and the last number the privileges of all other users.

The different modes you can choose between are "read", "write" and "execute". The relations between the numbers and the different modes are as shown below :

0 - - -

1 - - x

2 - w -

3 - w x

4 r - -

5 r - x

6 r w -

7 r w x

NB! Remember that both files AND folders must have their permissions set, and that the mode of a folder must be set to "execute" for a user to be able to see the contents.

Changin permissions with letters

Example : chmod a=rx,u+w filename

This command does exactly the same as chmod 755 .

The letters are " r" for "read", "w" for "write" og x for" execute". "+" means "add" og "-" means "subtract".

Do define which users the changes should affect you can use "a" for "all, "u" for "user" (i.e. you), "g" for "groups" and "o" for "other". The group "a" includes all of the other groups.

Another example : chmod a-x

This command will remove the executing permissions for all users.

index.html

If you have stored files in your public_html folder and made them readable for others, they will appear on http://folk.ntnu.no/username/. This alone might be useful enough, but a list of files is not much of a homepage. To make your homepage visible on this address, you have to make an html-file called "index.htm". This file must be placed in your web folder (public_html or Q:). Users accessing http://folk.ntnu.no/username/ will then automatically open this file, instead of just listing the files available in your www-folder. It is beyond the scope of this page to teach you how to write html-code. But a good way to improve your html-knowledge is to look at the source code of other web pages on the www. This can be done by choosing View - > Source / Source code.


Språk: en flag_no Kommentarer: 0 Aid: 297 Brukervurdering:
 
 
Sist oppdatert: 2007-07-04 Forfatter: skolmli Lest: 2472 ganger