The `-X` option enables X11 forwarding via ssh, i.e., permits opening graphical windows.
Consider using a `~/.ssh/config` configuration file to allow easier access like this:
```
Host *
ServerAliveInterval 60
ServerAliveCountMax 2
Host srvx1
HostName srvx1.img.univie.ac.at
User [USERNAME]
Host srvx2
HostName srvx2.img.univie.ac.at
User [USERNAME]
Host srvx8
HostName srvx8.img.univie.ac.at
User [USERNAME]
Host jet
HostName jet01.img.univie.ac.at
User [USERNAME]
Host login
HostName login.univie.ac.at
User [U:Account USERNAME]
```
and replacing `[USERNAME]` and `[U:Account USERNAME]` with your usernames. Using such a file allows to connect like this `ssh srvx2` using the correct server adress and specified username. Copy this file as well on `login.univie.ac.at` and you can use commands like this: `ssh -t login ssh jet` to connect directly to `jet` via the `login` gateway.
**From eduroam**: You should be able to log in as above.
**From the outer world**: First connect to the [UniVie VPN](https://zid.univie.ac.at/en/vpn/), then start up a terminal and log in as above.
**From the outer world**: First connect to the [UniVie VPN](https://zid.univie.ac.at/en/vpn/), then start up a terminal and log in as above. Consider using [connect2vpn](connect2vpn) script to do so. Set your U:Account username as environmental variable `$VPN_USER` and run `$ connect2vpn`, select split (only adresses within the UNINET) or full (all connections) tunnel and watch the connection information update every 10 seconds.
If you are a guest, you can apply for a [guest u:account](https://zid.univie.ac.at/uaccount/#c11096). This will give you access to eduroam and to the VPN. Your application needs to be endorsed by a staff member, who also determines the expiration date of the account.
### Connect Script
If you are using a terminal (Mac, Linux, WSL, ...) you can use the script [connect2jet.sh](connect2jet.sh) like this:
If you are using a terminal (Mac, Linux, WSL, ...) you can use the script [connect2jet](connect2jet) like this:
@@ -102,32 +131,37 @@ systemctl --user status vncserver@:[DISPLAY].service
`xrandr` gives you a list of available resolutions, that can be used.
Change the resolution to e.g. 1920x1080 (HD):
```
xrandr -s 1920x1080 -d $DISPLAY
```bash
$ xrandr -s 1920x1080 -d$DISPLAY
```
Adding resolutions according to your display's resolution have a look here: [add_xrandr_resolution.sh](add_xrandr_resolution.sh)
Note: `$DISPLAY` is an environment variable that is usually set to your VNC server port.
## Screen
[Screen](https://wiki.ubuntuusers.de/Screen/) is terminal session manager, that allows to start processes and reconnect to these processes after disconnection.
This starts a new session
```bash
screen -S longjob
$ screen -S longjob
```
You can detach from this session with `CTRL + A + D` and reconnect again with `screen -r`.
Multiple Sessions can be created and the output saved.
## Jupyterhub
On SRVX1 the TeachingHub and on Jet01 the ResearchHub is running and available to users and students. Connect to either [https://srvx1.img.univie.ac.at](https://srvx1.img.univie.ac.at) from everywhere or [https://jet01.img.univie.ac.at](https://jet01.img.univie.ac.at) from within the university network.
[Here](../TeachingHub.md) is more information on how to connect and authenticate.
# Q: ssh using key authentication?
In order to connect passwordless to a remote server a key needs to be generated.
```bash
>>> ssh-keygen -b 4096
```
$ ssh-keygen -b 4096
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
...
...
@@ -160,18 +194,18 @@ Assuming you're trying to transfer a file from a remote computer ("remote") to y
establish the tunnel via the third computer ("gateway") by typing this on your local computer:
```bash
ssh -fNL 12345:remote:22 gatewaylogin@gateway
$ ssh -fNL 12345:remote:22 gatewaylogin@gateway
```
Then you can run an unlimited amount of SCP commands on this tunnel (still typing on your local computer):
# Q: How to mount a remote file system on Linux (MAC)?
You can us programs like [Filezilla](https://filezilla-project.org/) or [Cyberduck](https://cyberduck.io/)(MAC) to transfer files between remote and local host. But sometimes it is much easier to mount a remote file system and work on it like an external drive.
You can use the [mountserver](mountserver) script to do so. This requires `sshfs` to be installed, on Linux that is in the standard repositories. A short into and some additional steps can be found [here](https://www.tjansson.dk/2008/01/autofs-and-sshfs-the-perfect-couple/).
This will mount the remote directory to the local directory. The local directory will be created if it does not exist. The directory should be empty before mounting, otherwise that will cause problems.