Linux/macOS
Terminal
To generate an SSH key pair:
[ user@PRT1234L ~]$ ssh-keygen -t ed25519 -C "john.doe@tecnalia.com" -f $HOME/.ssh/id_johndoe
Here the key pair is named "id_johndoe" as an example.
It is OK to leave the passphrase empty when prompted (i.e. no password). Be aware that if you choose a password your SSH-key based access may not work with SFTP software like FileZilla.
The public part of the key is found here "~/.ssh/id_johndoe.pub", and it is easiest to view the content like this
[ user@PRT1234L ~]$ cat ~/.ssh/id_johndoe.pub
Copy the content and send it to the admins.
After the public key has been uploaded to the login node by the admin, you can log into the system like this
[ user@PRT1234L ~]$ ssh user.name@hpc.tri.lan
# or if you are juggling many SSH keys
[ user@PRT1234L ~]$ ssh -i ~/.ssh/id_johndoe user.name@hpc.tri.lan
Your terminal window should display a login message, followed by a command line like this:
+---------------------------------------------------------------------------+
| |
| _ __ _ |
| | |/ /__ _| |_ ___ __ _ |
| | ' // _` | __/ _ \/ _` | |
| | . \ (_| | || __/ (_| | |
| |_|\_\__,_|\__\___|\__,_| |
| |
| ____ _ |
| / ___|___ _ __ ___ _ __ _ _| |_ ___ |
| | | / _ \| '_ ` _ \| '_ \| | | | __/ _ \ |
| | |__| (_) | | | | | | |_) | |_| | || __/ |
| \____\___/|_| |_| |_| .__/ \__,_|\__\___| |
| |_| |
| ____ _ _ __ |
| | _ \| | __ _| |_ / _| ___ _ __ _ __ ___ |
| | |_) | |/ _` | __| |_ / _ \| '__| '_ ` _ \ |
| | __/| | (_| | |_| _| (_) | | | | | | | | |
| |_| |_|\__,_|\__|_| \___/|_| |_| |_| |_| |
| |
| _ _ _ |
| | |__ _ _ | |_ ___ ___ _ __ __ _| |_ __ _ |
| | '_ \| | | | | __/ _ \/ __| '_ \ / _` | (_) _` | |
| | |_) | |_| | | || __/ (__| | | | (_| | || (_| | |
| |_.__/ \__, | \__\___|\___|_| |_|\__,_|_(_)__,_| |
| |___/ |
| |
| |
+---------------------------------------------------------------------------+
| |
| |
| IMPORTANT: Make responsible use of resources for the benefit of all. |
| All activities are logged. |
| |
| * User's Guide: |
| https://katea.digital.tecnalia.dev |
| |
| * For further questions, don't hesitate to contact us at: |
| soporte@tecnalia.com |
| |
+---------------------------------------------------------------------------+
[ user@hpc ~]$
For quick access it is recommended to make an "alias" in the "~/.bashrc" of your local machine:
[ user@PRT1234L ~]$ cat >> ~/.bashrc << EOF
> alias hpc="ssh -i ~/.ssh/id_johndoe user.name@hpc.tri.lan
EOF
After sourcing the "~/.bashrc" you can log in like this:
[ user@PRT1234L ~]$ hpc
Alternatively you can add a config file to your .ssh directory
[ user@PRT1234L ~]$ touch ~/.ssh/config
[ user@PRT1234L ~]$ chmod 600 ~/.ssh/config
then add information about hpc to the config file
[ user@PRT1234L ~]$ cat >> ~/.ssh/config << EOF
> Host hpc
> HostName hpc.tri.lan
> User user.name
> Port 22
> IdentityFile ~/.ssh/id_johndoe
EOF
You can now log in via
[ user@PRT1234L ~]$ ssh hpc
These instruction will not work for Windows command prompt.
Errors
Permission denied
If you get a permission denied error when trying to connect to hpc you can do the following to possibly solve your issue:
Your .ssh directory is located in your $HOME directory. Go to $HOME and type:
$ cd $HOME
$ ls -la .ssh
This will list the permission of the .ssh folder and files in the folder. Your common files (e.g. known_hosts) and public key files must have the following permissions: -rw-r--r--
To change to the correct permission type:
$ chmod 644 .ssh/known_hosts
$ chmod 644 .ssh/*.pub
You private keys must have the permission : -rw-------
To change to the correct permission type:
$ chmod 600 .ssh/id_johndoe
Finally, the .ssh folder must have the following permission : drwx------
To change to the correct permission type:
$ chmod 700 .ssh/