User Tools

Site Tools


ssh

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
ssh [2021/03/24 20:20] – [Copy public key to server] deulssh [2024/03/14 09:28] (current) jansen
Line 4: Line 4:
 Most of the desktop machine at the STRW can be accessed through the ssh protocol. So when you know your machine name, use that (including the strw.leidenuniv.nl domain) to access that machine directly. Most of the desktop machine at the STRW can be accessed through the ssh protocol. So when you know your machine name, use that (including the strw.leidenuniv.nl domain) to access that machine directly.
  
-If you do not have a personal machine you can use the ''%%ssh.strw.leidenuniv.nl%%'' virtual machine to log into our systems and continue from there with an ssh to any of the science servers or cluster machines.+If you do not have a personal machine you can use the ''%%ssh.strw.leidenuniv.nl%%'' virtual machine to log into our systems and continue from there with an ssh to any of the science servers or cluster machines. \\ 
 +Note that the %%ssh.strw.leidenuniv.nl%% machine is just a gateway; it is not meant for any type of data processing, desktop environments etc. 
 + 
 +See our [[ssh:tipsandtricks|Tips and Tricks]] session for 'direct access' to your server.
  
 === Special access === === Special access ===
-Some places we visit (e.g. China or Iran) or some hotels abroad limit the internet access to web browsing only. Because you want more in such cases the ssh server of the Sterrewacht now also serves the ssh protocol on web ports 80 and 443. So you can now get access to the Sterrewacht computer systems from those limiting environments using+Some places we visit (e.g. China or Iran) or some hotels abroad limit the internet access to web browsing only. Because you want more in such casesthe ssh server of the Sterrewacht now also serves the ssh protocol on web ports 80 and 443. So you can now get access to the Sterrewacht computer systems from those limiting environments using
  
   ssh ssh.strw.leidenuniv.nl -p 80 -l <your STRW accountname>   ssh ssh.strw.leidenuniv.nl -p 80 -l <your STRW accountname>
Line 34: Line 37:
 ====== SSH keys ====== ====== SSH keys ======
 ====Create a key pair==== ====Create a key pair====
-To create an ssh key pair, with the proper encryption, open up a console, and enter the following command:+To create an ssh key pair, with the proper encryption, open up a console on your local machine, and enter the following command:
  
   $ ssh-keygen -t ed25519   $ ssh-keygen -t ed25519
Line 60: Line 63:
    +----[SHA256]-----+    +----[SHA256]-----+
  
-When asked for a "passphrase", you should enter (a complex) one or optionally leave it blank. Note that without a passphrase your key pair will be free to use by anyone that has illegally gained access to your keys. passphrase is known to you only. +When asked for a "passphrase", you should enter (a complex) one or optionally leave it blank. Note that without a passphrase your key pair will be free to use by anyone that has illegally gained access to your keys. MacOS and Linux also have a feature where keys are unlocked using your login password. The passphrase should be known to you only. **Keep your private key and passphrase as secret as you would keep your password! 
 +**
  
 The ssh-keygen program will now generate both your public and your private key. Your keys are stored in the .ssh/ directory in your home directory. The ssh-keygen program will now generate both your public and your private key. Your keys are stored in the .ssh/ directory in your home directory.
Line 69: Line 73:
  
 ====Simplified version in case of a shared home disk==== ====Simplified version in case of a shared home disk====
-This is how you authorize the key for use within a local network with shared home disk. See below for the general case of accessing a remote system.+This is how you authorize the key for use within a local network with shared home disk (so this is how to set up a key so you can log in using ssh without password between computers at the institute) 
 +See below for the general case of accessing a remote system.
  
 Simply add the public part of the key to your .ssh/authorized_keys file, and make sure that that file is not accessible for others: Simply add the public part of the key to your .ssh/authorized_keys file, and make sure that that file is not accessible for others:
Line 86: Line 91:
 To be able to log in to remote systems using your pair of keys, you will first have to add your public key on the remote server to the authorized_keys file in the .ssh/ directory in your home directory on the remote machine. To be able to log in to remote systems using your pair of keys, you will first have to add your public key on the remote server to the authorized_keys file in the .ssh/ directory in your home directory on the remote machine.
  
-In our example we will assume you don't have any keys in the authorized_keys files on the remote server. (Hint: If you do not have a remote shell, you can always use your own useraccount on your local machine as a remote shell (ssh localhost))+In our example we will assume you don't have any keys in the authorized_keys files on the remote server. 
  
 First we will upload the public keys to the remote server: First we will upload the public keys to the remote server:
Line 106: Line 111:
  
 From now on you can login from client to server without having to specify a password (just a passphrase). From now on you can login from client to server without having to specify a password (just a passphrase).
 +
 +=== Using the keyring and ssh agent ===
 +Linx and MacOS offer a service to unlock your ssh keys (and other secrets) using your login password. This simplifies the use of passphrases on your keys, and you will only be prompted for the passphrase once when logging in (or not at all, if the session re-uses the login password). 
 +
 +=== Configuration file ===
 +Configuration for ssh can be stored at the client side (ie: on your laptop) in ''$HOME/.ssh/config''. This is a text file that can contain general options (in use on every ssh connection, unless you override them), and settings for specific hosts. A simple example:
 +  
 +    Compression             yes
 +    
 +    Host *.strw.leidenuniv.nl
 +         user mystrwusername
 +
 +For more details, see the ''man ssh_config'' manual page.
  
ssh.1616617233.txt.gz · Last modified: 2021/03/24 20:20 by deul