Connecting to the workstation
SSH Shell
SSH shell is enabled on qtech. Linux and macOS already have an ssh client. On Windows, different clients are available. A very popular client is PuTTY.
To connect to qtech, use the following command:
ssh username@qtech.fisica.unimi.it
username
is in general your surname (lowercase).
At the first login, you will need to insert the password provided during the creation of the account. You will be then asked to insert it again and then to insert a new, personal password. The general rules for strong passwords apply. Although all basic security measures are implemented to protect the workstation, it is in general unsafe to use the same credentials of other email/internet/bank accounts.
Contact the administrator if you need a password reset
To simplify the authentication process, a key authentication system is recommended
Authentication through SSH keys
Linux / macOS
A public/private key pair is required. If you don’t have one already, execute the following commands on your personal computer
mkdir ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t rsa
From Linux, you can simply issue the command
ssh-copy-id username@qtech.fisica.unimi.it
to copy the public key to qtech. Your password will be asked, for the last time.
On macOS, the command ssh-copy-id
can be installed with Macports or Homebrew. Otherwise, the public key can be copied manually with the command
cat ~/.ssh/id_rsa.pub | ssh username@qtech.fisica.unimi.it "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys"
Windows
This guide shows how to use PuTTY to generate a key pair and to copy the public key to the workstation.
For further information: https://help.ubuntu.com/community/SSH/OpenSSH/Keys
REMARK Commands issued from the SSH terminal are interrupted in case of a logout or disconnection. Long tasks may thus get killed if for any reason the client disconnects. To avoid this, please make use of the
screen
command as reported below
Use of the screen
command
The screen command creates a terminal that is not interrupted in case of disconnection. It is later on possible to reattach to that terminal and continue the work. The basic usage is
ssh username@qtech.fisica.unimi.it
screen
comando-lungo
You can detach from the terminal with the key combination CTRL + A
, D
.
To reconnect to an open screen session, use the command
screen -r
To list the open session, use the command
screen -ls
With the command exit
you logout from the virtual terminal.
For further information on the screen
command, use man screen
or use Google!
Mounting your home directory on your local computer with sshfs
It is possible to mount your home
directory on qtech on your personal computer using sshfs
.
After having installed the sshfs
command on your local computer, you can issue the command
sshfs username@qtech.fisica.unimi.it /path/on/your/pc
sshfs
can be easily installed on Linux using your distribution package manager. On macOS, you can install [Fuse and the sshfs package][4].
There are different SSHFS applications for Windows, but I haven’t tried any of those yet.
Graphical interface
There are two ways to use applications with a graphical interface: X11 forwarding or remote desktop.
X11 forwarding
You can view graphical applications on your desktop by forwarding the X11 graphical system through ssh
. In order to do so, a X11 server must be installed on your local computer:
- Linux: X11 is already available
- OSX: download available here
- Windows: You need to install cygwin or Xming (not tested)
To forward X11 use the command
ssh -Y username@qtech.fisica.unimi.it
** WARNING ** As for text commands, graphical applications are terminated in case of discconnection. To avoid this kind of problem, use Remote desktop as follows.
Remote desktop
Qtech uses TurboVNC as a VNC server. Each user can start a remote desktop using any VNC client. The configuration has been tested on Ubuntu and macOS with the default remote desktop applications.
-
Connect to
ssh
and launch the VNC server with the commmandvncserver -geometry 1280x800 -depth 24 -localhost
the option
-geometry
is followed by the required resolution.The first time the server will require you to set a password for the remote desktop. It is possible to leave the password empty, as the connection is already encrypted through SSH.
The server program will report that it started correctly on display number :[n], with a message like
Desktop 'TurboVNC: qtech:1 (qtech)' started on display qtech:1
Please take note of the number following
qtech:
. -
For safety reasons, the connection is allowed only through an SSH tunnel. On the client computer, issue the command
ssh -f -N -L 5900:localhost:5901 username@qtech.fisica.unimi.it
where the number
5901
must be replaced with the number5900 + n
, where n is the number of display reported by the server (see step 1). -
Now, use your VNC client to connect to
localhost:5900
. Some clients use the syntaxlocalhost:0
. It is possible to connect and reconnect to the server as long as it is running. To stop the server (and all the programs that are being executed) use the command (on qtech)vncserver -kill :1
where
:1
must be replaced with the screen number obtained at Step 1.