Skip to content
Snippets Groups Projects
Commit 5c391c53 authored by Michael Blaschek's avatar Michael Blaschek :bicyclist:
Browse files

Update SSH-VPN-VNC/connect2jet.sh, SSH-VPN-VNC/README.md files

parent 289587a5
Branches
Tags
No related merge requests found
...@@ -27,6 +27,17 @@ The `-X` option enables X11 forwarding via ssh, i.e., permits opening graphical ...@@ -27,6 +27,17 @@ The `-X` option enables X11 forwarding via ssh, i.e., permits opening graphical
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. 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:
```bash
connect2jet.sh -g [U:Account-Username]@login.univie.ac.at [Jet-Username]@jet01.img.univie.ac.at
```
There is also an option to forward a port, e.g. the VNC Port:
```bash
connect2jet.sh -g [U:Account-Username]@login.univie.ac.at -p 5901 [Jet-Username]@jet01.img.univie.ac.at
```
which allows you to connect to `localhost:5901` and view the VNC session. Other gateway servers can be `srvx1.img.univie.ac.at`
## VNC ## VNC
**Be aware! Everyone with the VNC password will get access to your account** **Be aware! Everyone with the VNC password will get access to your account**
......
#!/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] user@remote
Options:
-g [gateway] gateway server, e.g. user@login.univie.ac.at
-p [port] port to forward from jet to local, egv VNC port
Example:
$0 -g [U:Account-Username]@login.univie.ac.at [Jet-Username]@jet01.img.univie.ac.at
EOF
}
while getopts "g:p:h" flag;
do
case "${flag}" in
g ) gateway=${OPTARG}; ;;
p ) port=${OPTARG}; ;;
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
echo "Forwarding Port: $port"
command="-L ${port}:localhost:${port} "
fi
if [ -n "${gateway}" ]; then
echo "$gateway" | grep '@' > /dev/null
if [ $? -eq 1 ]; then
echo "Please give: [user]@[server], not $gateway"
exit 1
else
echo "Using gateway: $gateway to $remote "
ssh $command -t $gateway 'ssh ${command} ${remote}'
echo "$(date) | ssh $command -t $gateway 'ssh ${command} ${remote}'" >> .${script/.sh/.log}
fi
else
echo "Direct connection to: ${remote}"
ssh ${command} ${remote}
echo "$(date) | ssh ${command} ${remote}" >> .${script/.sh/.log}
fi
echo "Command Log in .${script/.sh/.log}"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment