Skip to content

Connection 101

Please find here some details on how to connect using SSH or VPN or VNC.

General Access

Please use these methods to access the servers:

  1. Connect using SSH or MOSH (Mobile Secure Shell)
  2. Connect using TeachingHub or ResearchHub
  3. Connect using VNC
  4. Access from outside the UNI via the VPN

Jupyterhub

Currently, there are two JupyterHub instances runnning:

  • TeachingHub on SRVX1
  • ResearchHub on Jet01

Connect to either via the wolke

Questions and Answers

Tools

Please find some useful tools for connecting to IMGW servers and University of Vienna VPN:

  • Shell script using SSH to connect via a gateway, SSH Download: connect2jet
  • Shell script for F5FPC tools, VPN Download: connect2vpn
  • Mount Server directories via sshfs, SSHFS
connect2jet
Connect to Jet
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
#!/bin/bash
# By Michael Blaschek
# Date 18.01.2021
# CC BY 4.0 International
# University of Vienna, Austria

# Description:
# Connect to Jet via a gateway server

help() {
    cat <<EOF
$0 -g [gateway] -p [port] -r [remote-port] user@remote
Options:
  -h                Help
  -g [gateway]      gateway server, e.g. user@login.univie.ac.at
  -p [port]         port to forward from jet to local, e.g. VNC port
  -r [port]         remote port if not the same as port
  -d                debug

Example:
   $0 -g [U:Account-Username]@login.univie.ac.at [Jet-Username]@jet01.img.univie.ac.at

EOF
}

debug=''
while getopts "g:p:r:hd" flag; do
    case "${flag}" in
    g) gateway=${OPTARG} ;;
    p) port=${OPTARG} ;;
    r) rport=${OPTARG} ;;
    d) debug='-v';;
    h | *)
        help
        exit 0
        ;;
    esac
done
shift $((OPTIND - 1))
command=""
remote=$1
script=$(basename $0)

if [ "${remote}" == "" ]; then
    echo "Remote host required: [user]@[server]"
    help
    exit 1
fi

if [ -n "${port}" ]; then
    # -L local_port:destination_server_ip:remote_port
    if [ -n "${rport}" ]; then
        echo "Forwarding Port: $rport to $port"
        command="-L ${port}:localhost:${rport} "
    else
        echo "Forwarding Port: $port to $port"
        command="-L ${port}:localhost:${port} "
        rport=$port # make sure we use this
    fi

fi
# Override Term information to make sure we use the ones on the servers
# export TERM=xterm-256color
# Check if names are in .ssh/config
remote_status=false
gateway_status=false
if [ -e $HOME/.ssh/config ]; then
    # check if hosts are there
    cat $HOME/.ssh/config | grep -i 'Host ${remote}' >/dev/null
    if [ $? -eq 0 ]; then
        remote_status=true
    fi
    if [ -n ${gateway} ]; then
        cat $HOME/.ssh/config | grep -i 'Host ${gateway}' >/dev/null
        if [ $? -eq 0 ]; then
            gateway_status=true
        fi
    fi
fi

if [ -n "${gateway}" ]; then
    echo "$gateway" | grep '@' >/dev/null
    if [ $? -eq 1 ] && [ ! $gateway_status ]; then
        echo "Could fail if not: [user]@[server], trying: $gateway"
    fi
    if [ -n "${port}" ]; then
        echo "Using gateway: $gateway to $remote "
        midport=$(($RANDOM % 1000 + 20000))  # 20000 - 21000
        echo "Port Forwarding via the gateway: $port : $midport : $rport"
        ssh $debug -L ${port}:localhost:${midport} -t $gateway ssh -L ${midport}:localhost:${rport} ${remote}
        echo "$(date) | ssh -L ${port}:localhost:${midport} -t $gateway 'ssh -L ${midport}:localhost:${rport} ${remote}'" >>.${script}.log
    else
        echo "Using gateway: $gateway to $remote "
        ssh $debug $command -t $gateway ssh ${command} ${remote}
        echo "$(date) | ssh $command -t $gateway 'ssh ${command} ${remote}'" >>.${script}.log
    fi
else
    if [ ! $remote_status ]; then
        echo "Could fail if not: [user]@[server]"
    fi
    echo "Direct connection to: ${remote}"
    ssh $debug ${command} ${remote}
    echo "$(date) | ssh ${command} ${remote}" >>.${script}.log
fi
echo "Command Log in  .${script}.log"
connect2vpn
Connect to VPN
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
#!/bin/bash
# By Michael Blaschek
# Date 31.07.2023
# CC BY 4.0 International
# University of Vienna, Austria
# Department of Meteorology and Geophysics
# img.univie.ac.at

# Description:
# Connect to VPN from the University of Vienna
# You need to download the F5 VPN Client from the ZID website (zid.univie.ac.at/vpn)
# The executable works only for VPN@UNIVIE. Follow the instructions on the ZID website
# on how to install the package depending on your Linux distro.
# Maybe this download link works directly:
# https://vpn.univie.ac.at/public/share/BIGIPLinuxClient.tgz
#
# Steps:
# 1. run connect2vpn script
# 1.1. Checks if it can find f5fpc exe 
# 1.2. Asks for credentials
# 1.3. Asks for TOTP Code
# 1.4. Watch connection

vpninfos() {
    infos=$(f5fpc --info)
    status=$(echo "${infos}" | grep '/Common/Remote-Access' | head -n1 | cut -d' ' -f3)
    cat <<EOF
[VPN] ${status}
[VPN] Connection Information. Use Ctrl+c to end.
===============================================================================
${infos}
EOF
}

if [ $# -eq 0 ]; then
    if [ "${VPN_USER}" != "" ]; then
        echo "[VPN] using '$VPN_USER'"
    else
        read -p "[VPN] u:account username: " VPN_USER
    fi
else
    VPN_USER=$1
    echo "[VPN] Using ${VPN_USER} as username"
fi

f5fpc -v 2> /dev/null 1>/dev/null
if [ $? -ne 0 ]; then
    echo "[VPN] Install Big-IP Edge Client. f5fpc missing"
    exit 1
else
    echo "[VPN] $(f5fpc -v | head -n1)"
fi

echo
echo "[VPN] Notice: This script will continue to run in foreground!"
echo
read -p "[VPN] Full (1) or split (None) tunnel? (1/None): " REPLY
if [ "$REPLY" == "" ]; then
    echo "[VPN] Connecting split-tunnel ..."
    cmd="f5fpc -s -t vpn.univie.ac.at"
else
    echo "[VPN] Connecting full-tunnel ..."
    cmd="f5fpc -s -t vpn.univie.ac.at:8443"
fi
echo "[VPN] Testing VPN Client..."
# Show status
export -f vpninfos
init=true
while true;
do
    f5fpc --info | grep "established" > /dev/null
    if [ $? -ne 0 ]; then
        if ! $init; then
            echo "[VPN] Restarting ..."
            f5fpc -o
        fi
        echo "[VPN] Starting connection ..."
        if [ -z "$VPN_PWD" ]; then
            read -sp "[VPN] u:account password:" VPN_PWD
            echo
        fi
        read -p "[VPN] TOTP Code (6 digits/empty):" VPN_TOTP
        if [ -n "$VPN_TOTP" ]; then
            eval "${cmd} -p ${VPN_PWD} -u ${VPN_USER}@${VPN_TOTP}"
        else
            eval "$cmd -p ${VPN_PWD} -u ${VPN_USER}"
        fi
        if $init; then
            init=false
        fi
    fi
    watch -n 2 vpninfos
    read -p "[VPN] Reconnect (1) or shutdown (None): " REPLY
    if [ "$REPLY" == "" ]; then
        break
    fi
done
unset VPN_PWD VPN_USER VPN_TOTP
echo "[VPN] Shutting down ..."
# Disconnect
f5fpc -o
echo "[VPN] disconnected"

Last update: February 1, 2024
Created: October 14, 2021