Secure Shell (SSH) Access
To run scripts, use software that has a GUI, or schedule jobs that consume a lot of resources (or run a long time), you can access the machine via SSH.
Shared Machine
This is a shared machine. Therefore, scripts that need a lot of resources and/or run for a long time should be submitted through a job scheduler. See Slurm. If you're too greedy, your account may be suspended.
Linux / Mac
First Connection
If you connect from a Mac or Linux machine, simply open a terminal and type.
Your prompt should change to some like this.
You can now run commands. Try typing ls -lisa
to see the contents of your home directory,
(base) volkerh@ds01:~$ ls -lisa
total 1859923
29 33 drwxr-xr-x 78 volkerh volkerh 149 Oct 21 11:22 .
34 9 drwxr-xr-x 32 root root 32 Oct 18 13:44 ..
6847922 9 drwx------ 3 volkerh volkerh 3 Sep 17 2018 Acl
6848920 1 -rw------- 1 volkerh volkerh 0 Jul 8 2019 .addressbook
7990012 9 drwx------ 3 volkerh volkerh 3 Oct 18 14:34 .apptainer
8022792 9 drwxr-xr-x 2 volkerh volkerh 4 Oct 18 14:53 apptainer
Here, you can also change your password (passwd
),
$ volkerh@ds01:~$ passwd
Changing password for volkerh.
Current password:
New password:
Retype new password:
passwd: password updated successfully
Generate / Upload SSH Keys
To improve security, you should generate SSH-keys to log in. This requires three steps
- Generate a public and a private key (
ssh-keygen
) - Upload the public key (
ssh-copy-id ds01.sintef.no
) - Add a server block to your ssh configuration (
/home/username/.ssh/config
)
On a Mac, you can do this as follows:
Generate Keys
Passphrase
Do not use an empty passphrase -- this is dangerous if your private key is exposed.
$ ssh-keygen
Generating public/private ed25519 key pair.
Enter file in which to save the key (/Users/volkerh/.ssh/id_ed25519):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/volkerh/.ssh/id_ed25519
Your public key has been saved in /Users/volkerh/.ssh/id_ed25519.pub
The key fingerprint is:
SHA256:AOQFYjFn+kLp87/uykNecvIQRpUI8BIOkqlwYCWEVBk volkerh@mbp
The key's randomart image is:
+--[ED25519 256]--+
|XXOEO+o. |
|X+oXoo. |
|+o=.. . |
|.+ .o . |
| +... S |
| += o |
| o.B |
| .o.. |
| o==. |
+----[SHA256]-----+
Upload Keys
$ ssh-copy-id -o PreferredAuthentications=password -o PubkeyAuthentication=no volkerh@ds01.sintef.no
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
volkerh@ds01.sintef.no's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'volker@hds01.sintef.no'"
and check to make sure that only the key(s) you wanted were added.
(base) % ssh ds01.sintef.no
(base) volkerh@ds01:~$
Update SSH Configuration
Multiple
If you already have another server block in the configuration file, you can just add a new one for ds01
anywhere in the configuration file.
Finally, make sure the SSH configuration (on your laptop!) contains a block like the following,
$ cat ~/.ssh/config
Host ds01
Hostname ds01.sintef.no
User volkerh
IdentityFile ~/.ssh/id_rsa
IdentitiesOnly Yes
[...]
where you should
- Replace
volkerh
with yourusername
onds01
. - Replace ~/.ssh/id_rsa with the private key file you generated above (likely something like
~/.ssh/id_ed25519
)
If everything has worked, you can just type ssh ds01
to connect to the server, i.e.
Windows
Windows 10 and above include an SSH client. You may need to enable the feature.
If you want to user another client, here is as short list of alternatives.
- Official OpenSSH windows feature (Free)
- Git for Windows (contains SSH, Free)
- KiTTY (Free)
- PuTTY (Free)
- SecureCRT ($$$)
- Ubuntu on WSL2 (overkill if only used for SSH, very useful otherwise, Free)
When prompted for a hostname, use ds01.sintef.no
.
After logging in, you should see something like above.
Data Processing on the Shell
To do some data processing, you probably want to use Python.
You can open an interactive session as follows.
(base) volkerh@ds01:~$ ipython
Python 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 01:22:34)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.3.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]:
More information about the Python environment and comm tools is available here.
To monitor resource usage, type htop
at the prompt.
To store scripts and programs, use /home/USERNAME
. To store data files, use /data/USERNAME
.
Using a Terminal
Here's a quick selection of guides on how to interact with a Linux system from the terminal.