School of Mathematical and Computer Sciences
MACS IT Frequently Asked Questions

Last updated: 2023-09-07

Acceptable Use Policy

See here for Heriot-Watt University's Acceptable Use Policy

QUESTIONS

GENERAL QUESTIONS

QUERIES & PROBLEMS

EMAIL, INTERNET & REMOTE ACCESS

PRINTERS, SCANNERS AND OTHER HARDWARE

DATABASES

DISK SPACE

LINUX QUESTIONS

GENERAL LINUX QUESTIONS

C & PROGRAMMING

ANSWERS

How do I contact the Help Desk?
Via email to ishelp@hw.ac.uk
What's the correct procedure for reporting problems?
First check this FAQ in case the problem is already a well known one. If it's not then you should contact the Help Desk.
All the folk in my class keep asking 'how do you do xyz' or 'what is the option to the pqr command to do abc?' - why isn't this in the FAQ?
We don't know that it's a frequently asked question, so tell us - contact the Help Desk and suggest it be included in the next version of this FAQ!
Who do I contact if there is a problem with `non-computing' hardware e.g., "the light in the loo is faulty"?
Email maintenance@macs.hw.ac.uk, describing the fault and its location.
How do I apply for Remote Access to the MACS Linux/Windows Machines?

There are 2 ways of possible remote access into the MACS Server (Linux or Windows Desktops)

First method Students ONLY is via an sshgw.
Refer to Remote Access SSH Gateway

Second method Staff ONLY is via the HW VPN.
Refer to HW VPN

Both of these methods rely on you having a Smart Device to receive the Multi Function Authentication (MFA) codes on. The first method (sshgw) is currently only suitable for linux connectivity, i.e. x2go client into the MACS Linux servers MACS Remote Linux Access

MACS students should email ishelp@hw.ac.uk and ask to be added to the MACS sshgw access list, before trying to to login via either of the above access methods.

Once authenticated on say the HW VPN, the user can use the normal remote access apps, PuTTy, Remote Desktop Connection, x2go client, to gain access to the MACS Linux or Windows Desktops (Remote Desktop Connection for Windows users).

The VPN can be downloaded here, install it onto your device and set it up to access the HW Domain, HW Azure, where the user login should be setup to allow access. Once installed the VPN can be setup to start automatically when the device boots up, Advanced Settings (bottom left icon), General, Startup [tick this option], input the HW user passwd and MFA code and the VPN is active.

Staff & Ph.D. students: The web server (www.macs.hw.ac.uk), has statically mounted $HOME directories now, hence the user web space isn't being used from the user www or public_html folders, they are on the web server. The user now needs to either copy over the files they need or remote login to the web server and go to their own web space and edit the files in situ. To remote copy files, use the command scp file.html macs_username@athena.macs.hw.ac.uk:/var/www/staff_pages/abcd1/www, the user will be asked for the MACS passwd. This command can be used from a windows cmd window or a linux command line. Windows users can use WinSCP, if it's installed on work machines to access athena.macs.hw.ac.uk directly, then the users can drag files from the left hand pane (remote or home machine) to the right hand pane (their web space) on athena. Via a web browser using the URL "https://www.macs.hw.ac.uk/~abcd1/file.html"

Students: Only students who are taking a Web Design module will be allocated web space on www4.hw.ac.uk, the URL would be formed from the course name and the student login, i.e. if the module is f27wd, student name abcd1, the URL "https://www4.hw.ac.uk/f27wd/abcd1/file.html". Students can copy their files into their own web space on the server, via windows Winscp or scp from the commandline, scp file.html abcd1@www4.hwa.c.uk:/var/www/html/f27wd/abcd1

This directory should already exist as it is created automatically when a new user account is set up. If it is not there then you will need to create it.

(Note that this directory and all its contents must be world readable and that some file operations under Microsoft Windows applications may change the permissions so that this is no longer the case.)

Create files in HTML format within that directory, using names such as file.html (See for example w3schools.com for tutorials on HTML.)

In the directory you want to protect, create a file .htaccess. Here is an example using user imcc :-
     AuthUserFile /home/imcc/.htpasswd
     #AuthGroupFile /home/imcc/.htgroup -- optional entry
     AuthBasicProvider file
     AuthType Basic
     AuthName "Access to this directory is restricted."
     Require user imcc
     

Use the command htpasswd to set a passwd for those allowed to get access to the web pages within the directory, like this:
/usr/bin/htpasswd -bc .htpasswd login_name passwd_you_wish_to_use

Points to remember :-

When specifying the AuthUserFile use the full path for the file, not `~`.

Make sure all html and .ht* files have permissions 644.

IMPORTANT: Note that this only protects your pages from remote users accessing the files via the web. It does not protect them from local users who can access them via the file system.

Place any scripts, perl (.pl), python (.py), shell scripts (.cgi) into your public_html folder within a sub-folder called cgi-bin. These scripts must be executable, to do this, run the linux command chmod 755 file.

The URL to run such scripts is https://www4.macs.hw.ac.uk/cgi-bin/abc1/filename, where filename could be file.pl, file,py, file.cgi.

An example perl script, should look like :-

     #!/usr/bin/perl --

     use warnings;
     use CGI;
     print CGI::header();

     print"Hello World\n\n";
     

An example python script, should look like :-

     #!/usr/bin/python3
     print("Content-Type: text/html")
     print("")
     print("""\
     
     
     Hello World!
     
     
     """)
     

Settings for Office365 in Thunderbird, for example user abc1
Incoming
Server Nameoutlook.office365.com
Port993
User Nameabc1@hw.ac.uk
Connection securitySSL/TLS
Authentication methodOAuth2
Outgoing
SMTP serveroutlook.office365.com
Port587
Connection securitySTARTTLS (TLS - Mobile Device Option)
Authentication methodOAuth2
User Nameabc1@hw.ac.uk

Check out :-Here

Settings for Office365 in .pinerc for alpine, for example user abc1
#User-Id
user-id=abc1@hw.ac.uk
# Name/path of inbox. (Folder path name or "{host}inbox" for remote IMAP inbox)
inbox-path={outlook.office365.com:993/ssl/user=abc1@hw.ac.uk/auth-xoauth2}inbox
# Name of SMTP server for sending mail. If blank, sendmail will be used
# Exchange SMTP Setup
smtp-server=outlook.office365.com:587/user=abc1@hw.ac.uk/submit/auth=xoauth2
# Folder Collection
folder-collections=imap {outlook.office365.com/ssl/novalidate-cert/user=abc1@hw.ac.uk}[]

Setup on your remote machine either the HW VPN (staff) or sshgw (student), to be able to remote authenticate into the MACS servers.

SSHGW
Refer to Remote Access SSH Gateway

HW VPN
Refer to HW VPN

Both of these methods rely on you having a Smart Device to receive the Multi Function Authentication (MFA) codes on.

Find and Run `Remote Desktop Connection`, on your Home Computer (laptop), in

When logging into your desktop using the Heriot Watt VPN connection, the Computer: box, input
hwpc00??-macs.hw.ac.uk, where '??' is the number of your machine, ask a MACS Systems person, if you don't know your machine name.
Click on Show Options bottom left, for User name: input :-
MAXP\your_macs_username go to Local Resources (menu bar in this box), Remote Audio, settings, Remote audio playback, untick Do not play, Remote audio recording, untick Do not record.

Click Connect, this should now connect to your desktop machine login screen.

Mathematica is available to use on 2 linux servers, namely amaterasu, baldur. These machines are public machines and can be accessed by remote logging into the main X servers or ssh terminal session.

The command to use Mathematica is mathematica, when you run it for the first time, you'll be asked to activate it, go down to the bottom menu and click on Activate by another Method, choose the third option (Network), input into the box flex.eps.hw.ac.uk for the FlemLM server. This should now start your Mathematica session. You should only require to do the activation the once only.

Use x2go. The client for Windows, Mac or Linux can be downloaded from x2go.org, and it is already installed on all MACS desktops and the University Desktop Service.

Once installed, start the x2go client. To configure a new session, choose Session->New Session from the menu. Give the session a name (e.g. "jove mate"), put in the hostname (e.g. "jove.macs.hw.ac.uk") and your username. Choose the Session Type at the bottom (e.g. "MATE"). DO NOT choose Gnome, as Gnome 3 cannot be used with x2go. Other settings you may want to change are your connection speed under the Connection tab, and window size under the Settings tab. It's also advisable to turn off Sound support under the Media tab, as this can cause some applications to freeze in a session. Then click OK and start the new session, putting in your MACS Linux password at the prompt.

amaterasu and perseu are running the ubuntu 24.04, and perhaps the Session Type might be best to be used XFCE.

The first time you connect to a host you will be asked to confirm that you trust the new host key, answer Yes.

When you first run x2go on Windows you might see warnings from the Windows firewall, you can safely Cancel these as x2go does not need access through the firewall.

You may connect to the following hosts:

AllStaff only
jove.macs.hw.ac.ukmull.macs.hw.ac.uk
osiris.macs.hw.ac.uk
amaterasu.macs.hw.ac.uk
perseus.macs.hw.ac.uk

amaterasu and jove now accept the user HW Credentials ONLY, osiris and mull still use the MACS Credentials.

amaterasu, perseus run ubuntu 24.04. osiris, jove, mull still run RockyLinux 8 OS.

Note that x2go sessions can be resumed if you lose the connection for any reason, making it ideal for connections from devices on Eduroam or other WiFi services.

MacOS users will need Xquartz (Xquartz.dmg) X windowing installed, get it from Here

Tip: Make sure your Linux startup files (.profile, .bashrc, .cshrc) work properly and don't give errors.

This FAQ is now obsolete, as nobody should require to access their old MACS $HOME.

Everyone is able to access their new directory from ~/shares/mdrive on the HW AD Domain.

If you need to use your MACS $HOME, say hosting your own personal web pages, in ~/public_html, you will need to mount it using the following commands, this has been setup along with a MACS linux passwd, which you should have received in your HW mailbox. Run the following 2 linux commands :-
mkdir /home/$HWUSER/home_dir
ALL USERS need to do this command the one time, in the /home/$HWUSER directory, to create the mount point used in the sshfs command.


For staff and phd students
sshfs $MACSUSER@home-server.macs.hw.ac.uk:/export/home/$PART_ADDRESS/$MACSUSER /home/$HWUSER/home_dir
where $MACSUSER is your MACS username, this maybe different from your HW username, especially for longer serving MACS staff, e.g. imcc -- ceeiam.
$HWUSER being your HW username, which maybe different from your MACS one.
$PART_ADDRESS can be obtained by logging into a MACS linux server and running ypmatch my_macs_username auto.home, giving -

mull( 1027 )ypmatch imcc auto.home
home-server:/export/home/1/staff:&
mull( 1028 )

you need to use the directory between the : for the $PART_ADDRESS.
Hence for MACS user, imcc, the full sshfs command would appear as -
sshfs imcc@home-server.macs.hw.ac.uk:/export/home/1/staff/imcc/ home/ceeiam/home_dir
sshfs will ask for the passwd for the $USER login, use the MACS one, NOT your HW one.

Once this has mounted you can access the MACS $HOME, via cd /home/$HWUSER/home_dir, there should be a directory, public_html in there where web pages should be placed. Other files can be saved in there also, these will be backed up nightly to tape backup. Files,etc placed at the /home/$HWUSER level are saved on the HW file system and backed up elsewhere.

There is a space limit of 10GB, on this /home space, this applies to all users (staff and students).

When you want to end your session, it is advised to unmount the /home/$HWUSER/home_dir with the command - umount /home/$HWUSER/home_dir, as it might not mount the next tuime you want to mount the MACS $HOME.

From Linux or MacOS or any other OS which includes ssh, use the command
ssh -D 8080 user@ssh.macs.hw.ac.uk

From Windows download plink.exe from the PuTTY suite, and use the command
plink.exe -D 8080 user@ssh.macs.hw.ac.uk
where user is your MACS login name

Then in your browser set the `SOCKS Proxy` option to `localhost` on port 8080.

All HP Printers have now been taken away, from all locations, and replaced with MFD (Multi Function Devices), the user needs to use papercut to print their jobs to this q, then go to the MFD, login using their 'staff card', and print whatever might be on their print q. You setup the papercut in ubuntu by logging into the papercut option, once, when the box appears at login. The 4 print options will then appear in the 'Print' option in the apps, the user wants to print from, okular, xpfd, etc.

Refer to MAC OS pcut setup
(this requires admin rights) and then to login on PaperCut using HWU account

List of lendable equipment which can normally be borrowed by arrangement for projects. Email lroot@macs.hw.ac.uk or a.c.hurt@hw.ac.uk (Adrian Hurt) to arrange to borrow anything from the list.
The MACS Mongo DB Server is mongodb-cloud-1.macs.hw.ac.uk IP Address 140.238.98.146 Port 27017

To access this use
mongosh --quiet --host mongodb-cloud-1.macs.hw.ac.uk -u username -p default_passwd --authenticationDatabase username
where username is your HW username
where default_passwd is a default password generated for you, and is usually sent to you, to be read from within your HW mailbox.

The MACS Postgres DB Server is pgsql-cloud-1.macs.hw.ac.uk, IP Address 132.145.18.149 Port 5432

To access this use
psql --no-psqlrc --quiet -h pgsql-cloud-1.macs.hw.ac.uk -U username -d username
where username is your HW username, using the default password, usually sent to you via email, hence should be found within your HW mailbox.

Simply right-click on the background and choose "Change Desktop Background" and set your background to a picture or solid colour.

Type man command where command is the command in which you are interested.

For example, to find out about the 'man' command itself, type man man.

Many programs also have documentation in GNU Info format, type info command.

You will also find various forms of documentation on system packages in /usr/share/doc/package-name-version.

In Linux use the command passwd and you will be prompted to enter your old password then give a new one. The system then makes a few simple checks on your proposed password and if it is o.k. you will be prompted to re-enter your new password so that you & the system agree on what you typed!

To change your password on a Windows system, once you have logged in with the old password, type Ctrl-Alt-Del and choose "Change Password". It is recommended you change the passwd to the SAME as you changed your linux one to, although not necessary.

Choose a password that contains a mixture of letters and digits, upper and lower case, no keyboard patterns, and no dictionary words or it may be rejected.

Use the command ypchsh and follow the prompts but remember that you must give the full pathname of the shell you want e.g. for tcsh give /bin/tcsh.
This facility is not available. You can get in touch with the help desk if your details are wrong.
To run a Servlet from the MACS development web server www4.hw.ac.uk:

Place your servlet class into the directory /opt/tomcat/webapps/$USER/WEB-INF/classes on the development web server (www4.macs.hw.ac.uk), where $USER is your username.

You must contact ishelp@hw.ac.uk to get this directory created for you if it doesn't already exist.

If your intended servlet isn't compiled, say a java source file, you will need to compile the source using the command javac file.java. YOu need to place the resultant file.class into your /opt/tomcat/webapps/$USER/WEB-INF/classes folder and add the name to the WEB-INF/web.xml file, as described below.

The CLASSPATH Env variable, should contain /opt/tomcat:/lib/*.jar:.

The URL required to view your servlet is http://www4.macs.hw.ac.uk:8080/$USER/file, where file is the file.class located in the `WEB-INF/classes` directory above.

You need to create a /opt/tomcat/webapps/$USER/WEB-INF/web.xml file which holds the names of all your servlets. You can create this file and add new servlet names to it by running perl /var/lib/tomcat/bin/make-web-xml.pl, This perl will create the initial web.xml file if it does not exist. If the file exists, it will prompt for the new servlet you've created and add it at the end of the web.xml file in your WEB-INF directory.

Here is an example web.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

    <description>
      imcc's application
    </description>
    <display-name>imcc's application</display-name>

<servlet>
        <servlet-name>imcc</servlet-name>
        <servlet-class>imcc</servlet-class>
</servlet>

<servlet-mapping>
        <servlet-name>imcc</servlet-name>
        <url-pattern>/imcc</url-pattern>
</servlet-mapping>

</web-app>

To run a Java Server Page (JSP) File from the MACS development web server www4.macs.hw.ac.uk:

Place your JSP File into the directory /var/lib/tomcat/webapps/$USER/ on www4.macs.hw.ac.uk. The help desk may need to create the $USER directory for you, as for the servlets above.

The URL to browse your JSP File running is http://www4.macs.hw.ac.uk:8080/$USER/file.jsp, where $USER is the same name as the directory given above.

(Windows 7) File, Save as, choose PDF in the file types.
You can transfer files to/from your MACS account from anywhere else on the internet using the scp/sftp or rsync protocols.

Using any of these you access host ssh.macs.hw.ac.uk using your MACS Linux username and password.

In Windows a suitable freeware client is WinSCP which gives you a Windows Explorer like window which allows you to just drag and drop files back and forth between the local and remote computers.

In Linux there are several options. You can use rsync (see man rsync), or several file managers such as konqueror have the sftp protocol built in so you can access a URL of the form sftp://username@ssh.macs.hw.ac.uk to get at your files.

To take screen shots from Linux you can use the command display. Right click in the Image Magick window which will appear to get the menu options, then click `Open...` to grab a screen section or window from your desktop. To save your selection right click in the Image Magick window, then click on `Save...`, click on `Format` for which format (jpg, bmp, tif, etc) you wish the image to be in. Input the file name you want to save the image to, possibly your $HOME directory if you are going use it in an MS Word document.

You can load the saved image into a MS Word document, by clicking on `Insert, Picture, From File ...` within Word, then selecting the file you saved in Linux.

This gives the simple commands that the user is likely to need for keeping an svn repository current.

Where can I get a HW MACS PhD Thesis Latex Template?
You can try option 1 or option 2.
I have compiled my program test.c (cc -o test test.c) It ought to give lots of screen output but when I try to run it, it just exits and the shell prompt appears again. Why doesn't my program work?
'test' is a shell reserved word - to run your program try ./test if it's in the current directory or else give the full pathname.
How do I add additional printers, or change my default printer?

In Windows the only printer selection will be \\pcut-site01-ed.hw.ac.uk\HW_print
In Linux (ubuntu) the setup is via the 'papercut icon' (green plus in the top menu bar), or the first time you login to a ubuntu machine, the papercut window should appear and you are asked to Install the 4 possible printers, when you input your HW login and passwd. The 4 printers should then be 'Installed', you can then leave the Papercut window, the 4 printer should then be visible in the apps you then print from, usually File, Print option.
Heriot-Watt University uses Microsoft Office365.

Using the HW Portal Email,click on the Email option