From SGEES Wiki
Revision as of 03:24, 19 March 2020 by Admin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Paswordless Login to Servers

Keep Connection Active

To save network resources ITS drops any not active connection by timeout (20 minutes). If you found this annoying, you might add the following lines to the top of your SSH configuration file (~/.ssh/config) :

Host *
  ServerAliveInterval 100


SSH config file can handle abbreviations and shortcuts for preferred hosts. For example:

Host 017
  User doejohn 

Instead of typing ssh you'll need only run ssh 017

Different Environment for Different Servers

You might find useful to set some environment variables depending on what server you've logged in. Just add following lines to the end of your ~/.bashrc (and edit them according to your needs):

if [ $HOSTNAME == "" ]; then
    # We're logged in locally to our desktop
    export PATH=$HOME/bin:$PATH
    . ~/.bash_completion
elif [ $HOSTNAME == "" ]; then
    echo "We are on SGEES017"
    export GMT_HOME=/usr/local/gmt
    echo "Logged in to: $HOSTNAME"

If connection is not reliable

When you connect to the server or remote computer via SSH and start some task, you probably want to be sure that your task will not be killed because of network or power failure somewhere between your computer and server. Fortunately there are several tools which could help you to operate with your remote running programs

Generic task manipulation

Ctrl+Z - active job suspend
jobs - jobs list
fg %job_number - put job to foreground (e.g.: fg %3)
bg %job_number - put job to background
disown %job_number - detach background process from terminal 

Examples of generic job managing

Variant 1: you have started a program over ssh and realized that you need to disconnect, but keep the process running:

bg %1 
disown %1 

Variant 2: start the process in background with nohup:

nohup my_program 

GNU Screen

Screen is a full-screen window manager that multiplexes a physical terminal between several processes, typically interactive shells. Here are some links useful for starting:

For first steps you might need to remember only few screen commands:

screen # start a new screen session
screen -D -R # force attach to the running screen session if any available
screen -list # get list of running screen sessions
screen -r # attach to the session by name

When in screen session:

Ctrl+a # standard command prefix
Ctrl+a c # create new window
Ctrl+a [1-9] # switch between windows
Ctrl+a " # window list
Ctrl+a d # detach session

A typical workflow with screen:

  1. Connect to the server
  2. Start new screen session or attach to existing one
  3. Run a program in screen session
  4. Detach session (and disconnect from the server)
  5. Re-attach the session to monitor the progress of running task


Tmux is a terminal multiplexer. What is a terminal multiplexer? It lets you switch easily between several programs in one terminal, detach them (they keep running in the background) and reattach them to a different terminal.


X2Go is a Remote Desktop solution, which some vendors vaguely call Remote Control. This is not to be confused with Microsoft Remote Desktop Connection, which is a competing Remote Desktop solution and protocol.

With X2Go, you mainly access Linux computers. The Linux computer you are accessing is the X2Go Server. (There are ways to connect to a Windows computer as well; some of them are only available with the Linux X2Go Client.)

You can connect from a computer running Linux, Windows or Mac OS X. This computer is the X2Go Client.

SGEES Linux machines already have X2Go client installed. For Windows or MacOS download and install client from here: