This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
ssh [2017/05/19 20:41] – deul | ssh [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 '' | + | If you do not have a personal machine you can use the '' |
+ | 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: | ||
=== 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 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 |
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 | + | To create |
- | $ ssh-keygen -t dsa | + | $ ssh-keygen -t ed25519 |
- | Generating public/ | + | |
- | Enter file in which to save the key (/ | + | |
- | Enter passphrase (empty for no passphrase): | + | |
- | Enter same passphrase again: | + | |
- | Your identification has been saved in / | + | |
- | Your public key has been saved in / | + | |
- | The key fingerprint is: | + | |
- | 7b: | + | |
- | When asked for a "passphrase", we won't enter one. Just press enter twice. | + | This results in the following output: |
+ | | ||
+ | Enter file in which to save the key (/ | ||
+ | Enter passphrase (empty | ||
+ | Enter same passphrase again: | ||
+ | Your identification has been saved in / | ||
+ | Your public key has been saved in / | ||
+ | The key fingerprint is: | ||
+ | | ||
+ | The key's randomart image is: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | . .++E.* | ||
+ | | ||
+ | | . ..X S | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
- | The ssh-keygen program will now generate both your public and your private | + | When asked for a " |
+ | ** | ||
- | Your keys are stored in the .ssh/ directory in your home directory, but you can store them where ever you'd like. | + | 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 file identity | + | The file '' |
+ | |||
+ | The file '' | ||
+ | |||
+ | ====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 (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/ | ||
+ | cat ~/ | ||
+ | chmod 600 ~/ | ||
- | The file identity.pub contains your public key, which can be added to other system' | ||
====Copy public key to server==== | ====Copy public key to server==== | ||
- | 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 | + | ===1. modern and easy, if it works=== |
+ | Nowadays, ssh comes with a utility to send a public key to a remote machine (requiring you to log in using your password once, or requiring a previous key to be already in place). This will take care adding the key to the authorized_keys on the remote system. To do this, simply use: | ||
+ | ssh-copy-id -i id_ed25519.pub user@remotehost | ||
+ | Actually, if you only have one key pair, you can leave out the -i and the name of the key to be copied, so this will do: | ||
+ | ssh-copy-id user@remotehost | ||
+ | |||
+ | === 2. the old way ==== | ||
+ | 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. | + | 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: | ||
$ cd .ssh/ | $ cd .ssh/ | ||
- | $ scp id_dsa.pub xxxx@zzzz:./id_dsa.pub | + | $ scp id_ed25519.pub user@remotehost:./id_ed25519.pub |
- | | + | |
- | This will place your keys in your home directory on the remote server. After that we will login on the remote server using ssh or telnet | + | This will place your keys in your home directory on the remote server. After that we will login on the remote server using ssh the conventional way... with a password. |
- | When you are logged in you should create a .ssh directory, and inside the .ssh/ directory create an authorized_keys | + | When you are logged in you should create a .ssh directory, and inside the .ssh/ directory create an authorized_keys file and add the keys to the file. Make sure the files are not readable for other users/ |
- | Placing the key for version 2 works as follows: | + | Placing the key works as follows: |
$ cd .ssh | $ cd .ssh | ||
- | $ touch authorized_keys2 | + | $ touch authorized_keys |
- | $ chmod 600 authorized_keys2 | + | $ chmod 600 authorized_keys |
- | $ cat ../id_dsa.pub >> | + | $ cat ../id_ed25519.pub >> |
- | $ rm ../id_dsa.pub | + | $ rm ../id_ed25519.pub |
+ | |||
+ | 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 '' | ||
+ | |||
+ | Compression | ||
+ | |||
+ | Host *.strw.leidenuniv.nl | ||
+ | user mystrwusername | ||
+ | For more details, see the '' | ||
- | ====== SFTP and SCP file access ====== |