Page tree
Skip to end of metadata
Go to start of metadata

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.

The shutdown of the old users.cs.helsinki.fi from year 2010

Old Ubuntu 10.04 based users.cs.helsinki.fi was permanently shut down 27.6.2017. If you had services running there you can (and should) move those services to the new server ASAP. When you login to the new server your files from old server (if any) will be available from a subdirectory users2010 in your home directory (if you had files on the old users server but don't have a users2010 subdirectory, check /home/users/yourusername). You can then move (or copy) those old files to htdocs, cgi-bin and tomcat directories to keep those services which you still need running in the new server. SQL dump of old postgres databases is available from users2010/postgres-dump.sql.gz. It is intentional that the old services won't migrate to the new server automatically. 

 

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.

 

$ ssh someuser@users2017.cs.helsinki.fi
The authenticity of host 'users2017.cs.helsinki.fi (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
Warning: Permanently added 'users2017.cs.helsinki.fi,128.214.11.42' (ECDSA) to the list of known hosts.

someuser@users2017.cs.helsinki.fi'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.1

Could 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:
* Welcome to users.cs.helsinki.fi. 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-htdocs

This script allows you to create or disable a www server available
from url https://jjaakkol.users.cs.helsinki.fi/
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+server

It 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.
Virtual host https://jjaakkol.users.cs.helsinki.fi 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-postgres

This 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)? y

Postgres 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=>

 

  • No labels