Table of contents:


Support

Please contact us via SmartDesk, Email servicedesk@id.ethz.ch  or by phone +41 44 632 77 77

Service Information



ETH students and employees own a space for a personal homepage. This homepage is available at http://n.ethz.ch/~<loginname>/ (The same homepage is also available via https.)


Access


The files of this personal homepage are stored on the general home directory provided by ETH, which might be different from the home directory provided by your institute. The foldername is "homepage"


Please see these instructions on how to access your NAS.Home

Access via ssh / putty

If you prefer to work with a command-line tool, you can access your homepage files by ssh-ing to slab1.ethz.ch providing your ETH username and password. Then, navigate to the subfolder homepage to edit the existing files (read on below).

Files in your homepage folder

When connected to the ETH home directory via smb or as network drive, there is a folder called “homepage”.

All the usual web-files placed in this folder will be world-wide available via the URL mentioned before https://n.ethz.ch/~<loginname>

Please do not change the name of the file index.html. This file is displayed by default when no other filename is specified. The index.html file can be edited with a standard text editor. Changes made to the file will be displayed immediately on the web-server. You might have to refresh your browser to see the changes in your browser.

Feel free to upload more files and link them within index.html. Please note that the space on your ETH home directory is limited to 2 GB at the moment.


Additional information


You can enhance your website using PHP, CGI, connect to a database or use authentication. Please read the attached documentation.

Protecting Directories

Authentication using a .htaccess.n File

If you would like to restrict access to your files or directories, you can protect them by using an authentication method. You can create your own user-management (File-based) or use a central user administration (AAI based).

Place a file named .htaccess.n in the protected directory /nas/<user>/<safedir>. Replace <user> by your username and <safedir> by the name of the directory you wish to protect. Please note: the file name should be .htaccess.n and not .htaccess.

Configure one of the following authentication methods.

File-based authentication

Using the htpasswd program, create a .htpasswd file with your users and store it in the /nas/<user>/<safedir> directory.

Add the following lines

SSLRequireSSL
AuthType Basic
AuthBasicProvider file
AuthName "File basierte Authentisierung"
AuthUserFile /nas/<user>/<safedir>/.htpasswd
require valid-user

to the /nas/<user>/<safedir>/.htaccess.n configuration file. This allows all users in your .htpasswd file to login to your directory.

If you wish to limit access to certain users, replace

require valid-user

by

require user <user1> <user2> ... etc.

selecting the appropriate user from your .htpasswd file.

AAI based authentication:

Example: restrict to valid AAI Users

Add the following lines

AuthType shibboleth
ShibRequireSession On
ShibRedirectToSSL 443
require valid-user

to the /nas/<user>/<safedir>/.htaccess.n configuration file. This allows all users with an AAI user account to login to your directory.

If you wish to limit access to AAI users with Unique IDs <unique id user1>, <unique id user2>, replace

require valid-user

by

require uniqueID <unique id user1> <unique id user2> etc.

AAI users must inform you of their unique IDs. AAI users find their Unique IDs at http://n.ethz.ch/shibboleth-test/show.

Example: restrict to AAI Users by eMail

by

AuthType shibboleth
ShibRequireSession On
ShibRedirectToSSL 443
require mail johndoe@student.ethz.ch

users must inform you of their registered eMail. external mailproviders like gmail, yahoomail, hotmail,... will not work. AAI users find their attributes at http://n.ethz.ch/shibboleth-test/show.

Enforcing Encryption:

According to the ETH BOT, only encrypted passwords, i.e. using HTTPS, may be transmitted over the net. To block HTTP access in file-based authentication add

SSLRequireSSL

to your .htaccess.n file.

Any http:// access will result in the appearance of an error page with Error Code 403 (Forbidden).

Dynamic Web Sites, Scripting

To design a dynamic web site, you have the option of writing your own programs or to avail yourself of existing projects ( e.g. for forums).

PHP

PHP Scripts are executed with suPHP, which means that scripts are executed with your user UID. Scripts must have the ending .php.

Configured options:

allow_url_fopen   off
display_errors    off
register_globals off
safe_mode         off

FAQ

How do I obtain additional information about the available PHP?                                                                                    

Create a script (e.g. info.php) with the following content:

<?php
phpinfo();
?>

My newly created or copied script does not function.

Please note that even PHP scripts must be executable. Follow the instructions on the CGI documentation page and make script executable.

CGI

The Common Gateway Interface (CGI) is an Apache extension allowing the user to create scripts with personal rights. To do this the script context is transformed with the help of a wrapper (suexec).

If you are not yet familiar with this concept, please read the official Apache Documentation, before posing any questions. In addition you can check Wipikedia on the subject.

For safety reasons, scripts are allowed in the cgi-bin directory only. In addition, to be recognized as such they must have the ending .cgi

To date, DFS does not have the ability to render files as executables. Using Unix it would be the "chmod u+x file" command. However, since DFS access runs over CIFS/Sharity, newly created scripts must be adapted with an smclient command. This can be done with Unix on a slab PC in the student computing labs or by remote :

$ smbclient //n.ethz.ch/<user> -Ud\\<user>
Password:
Domain=[D] OS=[Unix] Server=[Samba 3.0.26a-SerNet-RedHat]
smb: \> cd cgi-bin
smb: \cgi-bin\> chmod 755 test.cgi

You can ignore the "Pushing string of 'unlimited' length into non-SMB buffer!" message.


Environmental variables

To display environmental variables, create a sample script with the following contents:

#!/usr/bin/perl
##
##  printenv -- demo CGI program which just prints its environment
##

print "Content-type: text/plain\n\n";
foreach $var (sort(keys(%ENV))) {
    $val = $ENV{$var};
    $val =~ s|\n|\\n|g;
    $val =~ s|"|\\"|g;
    print "${var}=\"${val}\"\n";
}

Now copy this as printenv.cgi in your cgi-bin directory, render it executable and call it at URL http://n.ethz.ch/student/user/cgi-bin/printenv.cgi .

Interpreter

The Web server runs on a Linux operating system. You can therefore use the standard interpreters available. The following are most common:

  • /usr/bin/perl
  • /bin/bash
  • /usr/bin/python

 

Security

Utmost caution is required when using such scripts. Since scripts are executed within your user context these scripts have the right to delete all your data. Incidentally, the same applies to PHP. Thus pay particular attention to parameter processing and keep extraneous software up to date.

Debugging

In order to facilitate error tracing, we have put the “live” Web server error log file at your disposal:

https://n.ethz.ch/cgi-bin/error_log.cgi

Upon reloading page, output is updated (tail -f 50 error_log).



MySQL Database


Dynamic web pages often require a database. You have the possibility to apply for a 50MB account. We are currently using MySQL 5.7.27. The web-based admin tool, phpMyAdmin is centrally available from the IT Services at http://www.phpmyadmin.ethz.ch

Activate/delete your database in the IT-Shop https://itshop.ethz.ch/.


Regulations


A personal website (homepage) is available to all ETH employees and students for free of charge.

No order is required. The service is only expected a directory homepage in the central personal home directory.

Use is subject to the Rules of usage of Telematics at ETH Zurich.

Regarding content please refer to Section 3 in Article 8ff.

By using your common sense you will surely figure out which contents are permissible on ETH web pages. Web pages with pornographic, sexist or politically incorrect contents as well as commercial marketing are not permitted. The dissemination of copyright protected data is forbidden!

Any transgression will result in appropriate consequences.

Please take note of the ETH Zurich Acceptable Use Policy for Telematics Resources (BOT):

https://rechtssammlung.sp.ethz.ch/Dokumente/203.21en.pdf


  • No labels