OUTDATED: Users.cs.helsinki.fi web server

Last modified by Ville Hautakangas on 2024/05/06 15:59

Please note that this is old documentation for a server that no longer exists.


WWW server users.cs.helsinki.fi is a place where CS Department's students and users can maintain their own web pages and services. It is primarily meant to be used as a tool for courses teaching web development, but can be used also for other simple web services, where maintaining a complete server host would be overkill.

Users.cs.helsinki.fi supports static pages, cgi-scripts, php, and J2EE using Apache tomcat. Its users also can request access to a postgres database and it is an officially sanctioned space to run cron scripts.

The web services are visible through virtual http hosts, like this example page at https://jjaakkol.users.cs.helsinki.fi/.

The server is implemented with University's Cubbli Linux system, which is based on Ubuntu 16.04. The new server became first operational 18.5.2017.

Access to users.cs.helsinki.fi

The server is accessed using a ssh client. You ssh to users.cs.helsinki.fi using your AD user account and request (or shut down) services using the command line. When you first login to the server a new local home directory will be created for you. The local home directory can also be accessed throught sftp.

@users2017.cs.helsinki.fi$ ssh someuser
users2017.cs.helsinki.fiThe authenticity of host ' (128.214.11.42)' can't be established.
ECDSA key fingerprint is SHA256:QZE8BEHDTZ6F+AmD4zWENkIeYErdblSoaVEXM++I9FI.
Are you sure you want to continue connecting (yes/no)? yes
users2017.cs.helsinki.fiWarning: Permanently added ',128.214.11.42' (ECDSA) to the list of known hosts.users2017.cs.helsinki.fisomeuser@'s password:
Welcome to Ubuntu 16.04.2 LTS (GNU/Linux 4.8.0-52-generic x86_64)<snip>* This is users.cs.helsinki, year 2017 model.<snip>Last login: Thu May 18 14:29:28 2017 from 192.168.1.1Could not chdir to home directory /home/someuser: No such file or directory
* You do not have a home directory in the users2017 web server yet.
* Please consult the instructions at;
http://wiki.helsinki.fi/display/it4sci/Users.cs.helsinki.fi+web+server* Do you really want to start using users2017 (y/n)? y
Type your AD password.
[sudo] password for someuser: 
users.cs.helsinki.fi* Welcome to . Your new home directory is now ready.
someuser@users2017:~$

Enabling the WWW service

Use the script wanna-htdocs to enable or to disable the WWW service. The script creates two subdirectories in your home directory: htdocs, where static web pages and php-scripts are stored and cgi-bin where cgi-scripts are stored. 

jjaakkol@svm-2:~$ wanna-htdocsThis script allows you to create or disable a www server available 
https://jjaakkol.users.cs.helsinki.fi/from url 
with Apache web server DocumentRoot pointing to directory 
/home/jjaakkol/htdocs in your home directory. It also allows you to 
run CGI-scripts and PHP-scripts on the web server using your own user 
account. More info is available from:
https://wiki.helsinki.fi/display/it4sci/Users.cs.helsinki.fi+web+serverIt will also permanently disable your old web server in the old users
server from year 2010.Would you like to enable the https virtual host now (y/n)? y
Generating new web server configuration (this will take some time)...
Apache configuration not changed.
https://jjaakkol.users.cs.helsinki.fiVirtual host  is now enabled.

Error and access logs are in /home/userlogs/

Creating and accessing your own Postgres 9.5 database

An postgres user account and an empty postgres database  belonging to that user account with a random password can be created with the command wanna-postgres. The the name of the user account  and the name of the database will be the same as your login user account (kasitunnus).  

jjaakkol@users2017:~$ wanna-postgresThis script can create a local Postgres 9.5 database account and
empty postgres database for you. Do you want to create a new 
postgres user jjaakkol and database jjaakkol now (y/n)? y
[sudo] password for jjaakkol: 
New postgres user 'jjaakkol' and database 'jjaakkol' have been created for you.
You can connect it directly from command line with command 'psql'.Postgres password reset to 'xxxxxxxxxxx'.
Password also saved to file '/home/jjaakkol/.psql_password'.

If you want to reset the password, you can do it by running command wanna-postgres again:

jjaakkol@users2017:~$ wanna-postgres
You already have a working psql account.
You can reset your postgres password with this script or
alternatively just use SQL to reset it yourself.
Would you like to reset your postgres password now (y/n)? yPostgres password reset to 'xxxxxxxxxx'.
Password also saved to file '/home/jjaakkol/.psql_password'.

The database can then be accessed directly from the command line:

jjaakkol@users2017:~$ psql
psql (9.5.6)
Type "help" for help.jjaakkol=> create table movies (name varchar, year integer);
CREATE TABLE
jjaakkol=> insert into movies values ('Holy Grail', 1975);
INSERT 0 1
jjaakkol=> insert into movies values ('Life of Brian', 1979);
INSERT 0 1
jjaakkol=> insert into movies values ('The Meaning of Life', 1983);
INSERT 0 1
jjaakkol=> select * from movies where year=1979;
 name | year 
---------------+------
 Life of Brian | 1979
(1 row)jjaakkol=>