UNIX
Terminal
To generate an SSH key pair:
[..]$ ssh-keygen -f ~/.ssh/id_name -t rsa -b 4096
Here the key pair is named "id_name" as an example.
It is OK to leave the passphrase empty when prompted (i.e. no password), though this is less secure.
The public part of the key is found here: "~/.ssh/id_name.pub". It is easiest to view the content like this:
[..]$ cat ~/.ssh/id_name.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:
[..]$ ssh <uname>@elja.hi.is
# or if you are juggling many SSH keys
[..]$ ssh -i ~/.ssh/id_name <uname>@elja.hi.is
Your terminal window should display a login message, followed by a command line like this:
[<uname>@elja-ihpc ~]$
For quick access, it is recommended to make an "alias" in the "~/.bashrc" of your local machine. For example:
[..]$ cat >> ~/.bashrc << EOF
> alias elja="ssh -i ~/.ssh/id_name <uname>@elja.hi.is"
EOF
Then source the "~/.bashrc" to apply the changes:
[..]$ source ~/.bashrc
Finally, you can log in like this:
[..]$ elja
Alternatively, you can add a config file to your .ssh directory:
[..]$ touch ~/.ssh/config
[..]$ chmod 600 ~/.ssh/config
Then add information about Elja to the config file:
[..]$ cat >> ~/.ssh/config << EOF
> Host Elja
> HostName elja.hi.is
> User <uname>
> Port 22
> IdentityFile ~/.ssh/id_elja
EOF
You can now log in via:
[..]$ ssh Elja
These instructions will not work for Windows command prompt.
Errors
Permission denied
If you encounter a permission denied error when attempting to connect to Elja, try these steps to resolve the issue:
Your .ssh directory is located in your $HOME directory. Go to $HOME and type:
$ cd $HOME
$ ls -la .ssh
This will list the permissions 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 permissions, type:
$ chmod 644 .ssh/known_hosts
$ chmod 644 .ssh/*.pub
Your private keys must have the permission: -rw-------
To change to the correct permissions, type:
$ chmod 600 .ssh/id_name
Finally, the .ssh folder must have the following permissions: drwx------
To change to the correct permissions, type:
$ chmod 700 .ssh/