Usage of public_html directory
This requires a VPN connection.
Contents of this instruction:
What is public_html?
The public_html directory is a directory located on a Unix server in your home directory, which is primarily intended for publishing one’s own web pages. That’s why it’s also well suited for distributing your own (attachment) files, because it’s easy for others to go and get the files they need using a web browser.
How to create the public_html directory
On the Windows side, select File > New > Folder in the file manager (Windows Explorer) and name the new directory public_html.
The same can be done via a terminal connection in your own Unix home directory by entering the command
mkdir public_html
You can check the existence of the directory with the command ‘ls -l’ or just ls. If you want to find out the entire path, type pwd as the command.
File transfer
Files can be moved to that directory using the traditional Windows file manager, provided that your home directory on the Unix server is linked to File Explorer. When you are outside the school network, you can use e.g. SFTP or SCP for file transfer.
public_html directory in the internet
When using a browser, everyone’s public_html directory is displayed online at their own address. For students, the address is in the form:
http://www.students.oamk.fi/~username/
and for staff staff:
http://www.oamk.fi/~username/
If necessary, subdirectories can be created under the public_html directory. For example, if a user whose ID is a token creates a subdirectory called ‘exercises’, it will then appear at
http://www.students.oamk.fi/~username/exercises/
(Note that directories and files should not be named with å, ä and ö, but should be replaced with a and o)
Saving files in your browser
Normally, you can copy a file by clicking on the link pointing to it with the mouse.
However, this does not work in all cases, in which case you have to right-click on the link. This will open a small menu from which you can select ‘Save Link As…’. In this case, the file will be saved as it is and certainly correctly.
index.html is first page of the directory, that hides directory listing
When you type e.g. your home page address (www.students.oamk.fi/~username), the browser automatically searches your public_html directory for a index.html file and downloads it when it finds it. http://www.students.oamk.fi/~username/ is the same as http://www.students.oamk.fi/~username/index.html
The index.html file is the home page of the directory where the index.html file is located. If the file in question cannot be found, the browser will show the entire contents of the public_html with its subdirectories to all people around the world (if the public_html directory has been given read access to the whole world). If you put a index.html page in your directory, the browser must know the exact address of the other files in the directory in order to access them.
You don’t necessarily need an index file to prevent a directory from being listed on the web: You can also adjust the permissions of your directory so that the directory can only be opened, but its contents cannot be listed. In this case, the reader must not have read access to your directory (= listing the directory), but only the right to access (= opening the directory).
If the listing of the directory has been blocked with rights or hidden with an index file, the exact address of the file must be sent to the parties concerned, e.g. or the link must be forwarded to the reader in some other way.
⇒ Learn more about defining permissions on the homepage.
Creation of index.html
The file can be made with any text editor, e.g. on Windows, with Notepad or Wordpad, as long as you remember to save it in text format. Here is a sample of a simple web page that can be made by those who do not have time to look into the matter further:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="author" content="Your Name"> <meta name="robots" content="index, nofollow"> <title>job title</title> </head> <body> <h1>Your Name</h1> <p>Work address <br /> Zip code and city <br /> Phone <br /> </body> </html>
Copy the above into your text editor and change the information to Title, My Name, Address and Phone Number (the boxes are shown in red if your browser supports style sheets and style sheets are turned on). Save the file in text format as index.html public_html directory.
Note that you can also put your own index.html pages in each subdirectory of the public_html directory. The index file is always stored at the root of each subdirectory, and the file always serves as the front page for the directory where it is located. Note that if you put e.g. public_html/minutes/ directory, they will not be visible in the browser if there is an index file in the directory, even if the directory has been given listing rights (= read rights) for the whole world. Those pages would then only be accessible with a direct link to the protocol in question. Files. On the other hand, if you want the contents of your directory to be visible to the whole world, do not put an index file in the directory and also remember to set the permissions for the folder to run and read rights for the whole world.