Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of contents:

Table of Contents
maxLevel2


Excerpt Include
IT Knowledge Base
IT Knowledge Base
nopaneltrue

Note

Switch to the page in German language


Info
titleService Information

IT Service Catalogue




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.

Access for Linux and Mac OS X

To access the homepage, you can connect to your ETH home directory using the smb protocol. The server location and path to your home directory are:

Code Block
smb://d.ethz.ch/users/all/<username>

Please provide your login credentials to connect to the server.

Access for Windows

Windows users can connect using the following address:

Code Block
\\d.ethz.ch\users\all\<username>\

The home directory can be mapped to a drive letter. This process is richly documented od 3rd party websites (https://www.google.com/search?client=firefox-b-d&q=windows+map+network+drive).

The foldername is "homepage"


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

Access 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 httphttps://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

Code Block
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

Code Block
require valid-user

by

Code Block
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

Code Block
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

Code Block
require valid-user

by

Code Block
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

Code Block
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

Code Block
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:

Code Block
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:

Code Block
languagephp
<?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 :

Code Block
$ 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:

Code Block
languageperl
#!/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