<> == In Windows == If you have a Windows machine, you can open an ''Command Prompt'' or ''Windows Powershell'' and connect to LST network with: {{{ ssh username@login.lst.uni-saarland.de }}} and then start the application, script of whatever you want to use. (If it's your first time you may confirm the connection to this server once.) A more convenient approach may the use of an graphical ssh manager like https://www.bitvise.com/ssh-client-download == In Linux == If you have a Linux machine, this is quite easy. Use: {{{ ssh -X username@login.lst.uni-saarland.de }}} and then start the application, script of whatever you want to use. For looking at your email box, you can also configure your email client at home. If you would like to run compute jobs, please use the compute cluster machines: https://wiki.lst.uni-saarland.de/wiki/index.php?title=User_Doc#Printing.2C_Compute_Cluster_and_other_Services == Tunneling to a cluster node == To connect from the outside directly to a cluster node you could use this: {{{ ssh -t login.lst.uni-saarland.de ssh jones-6 }}} == Screen == Imagine the following scenario: You're at home, and you would like to use your home internet connection (DSL or whatever) to log into !CoLi to check your email, process some data with a script, or whatever else. As you're working, your internet connection is suddenly reset. Everything you were working on that you hadn't saved is lost, or the script process you had running is orphaned (i.e. you can't see what's happening) or even killed. If this sounds familiar, read on. You can use '''screen''' to create a persistent terminal session. This means the session will continue to run even if you are disconnected, and you can even explicitly "detach" from a screen session and re-attach again later (even from somewhere else!). You can even have several terminals (''windows'') open within the same screen session and switch between them easily. === Example === I want to process some data, and I know it will take my machine several hours to complete this process. I open a terminal, type '''screen''' to start a new screen session, and start my processing script. I press '''Ctrl+a, d''' to detach from the screen session, then I log out of my machine and go home. A few hours later, I want to know how my script is doing, so I log into my machine (via ''login'' from the outside), type '''screen -r''' to reattach to the screen session, and there is my script, just as I left it, busily munching away at my data the whole time. === More elaborate example === I want to split my script into two "threads" that will run simultaneously on two different machines (in half the time, obviously). I start my screen session as before, then start the first thread. Then I hit '''Ctrl+a, c''' to start a new window within screen, log into the other machine, and start the second thread. Now, within the single screen session, I can switch back and forth between the windows with '''Ctrl+a, p''' and '''Ctrl+a, n''', respectively. Detaching from the screen session works just as before. === Some useful commands === Typing '''screen -ls''' will show the running screen ''sessions'' on the current machine. You can specify which session you want to reattach to by typing the desired screen session's identifier after the '''-r'''. You can even attach to the same session from multiple terminals by using '''-x''' instead of '''-r'''. This way, you could display different windows running in the same screen session simultaneously. Within a screen session, you can see a list of available windows by typing '''Ctrl+a, "''', and even copy and paste text from one window to the next. Since the '''Ctrl+a''' command is used to prefix screen commands, you'll probably have to use '''Ctrl+a, a''' instead of just '''Ctrl+a''' to e.g. jump to the beginning of the line at the prompt. To close a screen window, just type '''exit''' (or '''Ctrl+d''') as you would normally. If you close the last window, the screen session is terminated. Be careful not to confuse '''Ctrl+d''' with '''Ctrl+a, d''', or you'll end up terminating your screen session instead of detaching from it... === More info === Within screen, type '''Ctrl+a, ?''' for a help screen. Type '''man screen''' for the screen manpage. Go to http://aperiodic.net/screen/ for an entire Wiki (including tutorials) about every aspect of screen. == VNC == Another scenario: You want to work under X Windows from home. You may or may not have figured out how X forwarding works, but if you have, you've suffered the realization that it's slow to the point of uselessness. Again, if your internet connection is suddenly disrupted, your session is lost. You can use '''VNC''' to create a persistent X Windows session (''VNC Server'') that you can connect to (using a ''VNC Viewer'') from wherever you have internet access (preferably broadband). This works similarly to Microsoft's ''Remote Desktop'' in that your input (mouse and keyboard) is forwarded to the VNC Server and the screen display is sent to your VNC Viewer as a series of bitmap images, which are easy to compress and much less complex than the window structure itself (i.e. it's much faster). === Setup === If you've never used VNC before on your machine, you have to setup a VNC password (which is different from your CoLi account's password). To do this, type '''vncpasswd'''. You only have to do this once (and later only to change your VNC password). Start a VNC Server on your office machine by typing '''vncserver'''. Note the ''desktop number'' given in the output (i.e. the '':1'' in ''mymachine:1''). You can now connect to this VNC Server by typing '''vncviewer ''mymachine'':1''' (or whatever that number was). You will be prompted for your ''VNC'' password after which you'll have a fully working X session within your normal session. Closing the VNC Viewer does '''not''' terminate this session, so you can reconnect to it later. === Connecting from elsewhere === Of course, the point is to be able to connect to this VNC Server from home. To do this, you'll need a local VNC Viewer. Since the flavor of VNC installed at !CoLi is [[http://www.realvnc.com|RealVNC]], it makes sense to use the RealVNC Viewer program for whatever your home computer's operating system is. But you could just as well use a different VNC implementation, such as [[http://www.tightvnc.com/|TightVNC]]. For Windows, this is a very small executable (i.e. it doesn't need to be installed), available for free. Download it from http://www.realvnc.com/download.html, choosing the ''Free Edition'', ''Stand-alone Viewer''. Or install the whole package, but to connect to your !CoLi machine, you only need the viewer. For Linux, use either your distribution's package management system to get the viewer, or [[http://www.realvnc.com/download.html|download]] the Linux version of the Free Edition. For MacOS, there are a few freeware VNC clients. [[http://www.jinx.de/JollysFastVNC.html|JollysFastVNC]] is fast and stable (despite being in the alpha stage). [[http://sourceforge.net/projects/cotvnc/|Chicken of the VNC]] is another client, which however seems to be rather sluggish. Alternatively, you can use VNC's built-in webserver and Java applet to connect to your VNC Server via any Java-enabled web browser. To do this, simply point your browser to '''port 5800 + ''desktop number''''' on ''mymachine'', i.e. `http://mymachine:5801/`. This will open an applet which allows you to log into your VNC Server directly. '''HOWEVER...''' === SSH Tunneling === ...you will not be able to reach your machine directly. You need to use ''SSH tunnels'' to map your machine's relevant port to a port on your home computer, passing through ''login''. Under Windows, this can be done with e.g. [[http://www.chiark.greenend.org.uk/~sgtatham/putty/|PuTTY]] in several easy steps: 1. Start PuTTY 1. Under ''Session'', ''Host Name'', enter ''login.lst.uni-saarland.de'' 1. Under ''Connection'', tick ''Enable TCP keepalives'' 1. Under ''Connection'', ''SSH'', ''Protocol Options'', tick ''Enable compression'' 1. Under ''Connection'', ''SSH'', ''Tunnels'', ''Source Port'', enter '''5900 + ''desktop number''''', i.e. ''5901'', then for ''Destination'', enter ''mymachine:5901'', then click the ''Add'' button (substitute your actual machine name for ''mymachine'') 1. To save yourself the trouble of having to do this every time, go back to ''Session'', enter some name under ''Saved Sessions'', and click the ''Save'' button. This way, you can just double-click on that name to connect to ''login'' with all tunnel settings, etc. already set 1. Click the ''Open'' button 1. If you get a "PuTTY Security Alert" window, just do what it says 1. Back on your home machine, start the VNC Viewer program, and enter '''localhost: + ''desktop number''''', i.e. ''localhost:1''. If you followed all of the above steps, you should be greeted with the opportunity to enter your VNC password, after which you'll be connected to your running VNC Server. 1. When finished, just close the viewer window If you want to connect via your web browser, using the Java applet, substitute '''5800''' for all references to port '''5900''' in the instructions above, and open the URL e.g. http://localhost:5801/. Under Linux/OSiX, just type '''ssh -Cc blowfish -L 5901:mymachine:5901 login.lst.uni-saarland.de''' to log into ''login'' with an SSH tunnel to ''mymachine'' as detailed above. === Sample bash script === To easily open or close the tunnel on ''login'', you could use a script like the following: {{{ #!/bin/bash # adjust the following two lines as appropriate: port=5901 host="mymachine" tunnel="ssh -CfNc blowfish -L $port:localhost:$port $host" echo "/$tunnel\$/{print \$2}" > awktempfile pid="$(ps -fu $USER | awk -f awktempfile)" rm -f awktempfile if [ -z $pid ]; then echo "Opening tunnel to $host:$port" $tunnel else echo "Closing tunnel to $host:$port (PID $pid)" kill $pid fi }}}