[TOC title:Table-of-Content]
<br/><br/>
Before following the instructions below, make sure you have an account. If you don't have an account, visit [get-an-account](../get-an-account) to request one.
Also, make sure you are connected to the WUR VPN.
## Potato and micevo Users
Current Potato/Helicoprion users can log in with their existing passwords. The first time they do so, they will be prompted to change their password. Follow the steps below to secure your account with an SSH key.
Use the following command to log in to the server and change your password: You will need your current/old password.
```sh
ssh username@valhalla.wur.nl
#OR
ssh username@10.124.35.35
```
We will manage data transfer after your account is setup.
## Account and connection setup
Once you have an account, we encourage you to secure it before you start using it actively.
First, change the temporary password you received for your initial login. If you have not done so already, create SSH keys to secure your future connections.
To change your password, use the command shown below. You will be asked for your current password and your new password, which you will need to enter twice.
```sh
# Change your password
passwd
```
#### Set up an SSH key for future connections to the servers
Once you have changed the initial password, the next step is to set up an SSH key. This provides greater security than a password alone.
We strongly recommend that all users set one up.
This is how it works: on your laptop, generate a pair of files for your key — a public key and a private key. The private key file should always stay on your laptop, in a location to which only you have access. Never share this file with anyone. The private key is also protected by a passphrase, which should be as strong as your password. This is because even if someone else obtains your key, they still need to provide the associated passphrase to be able to use it.
The public key, on the other hand, is placed on computers that you want to be able to access. Without the corresponding public key, your private key is useless.
### For MacOS and Linux users
If you work on MacOS or Linux, you can run the commands below line by line, and make sure each line runs without errors.
```sh
my_username="PUT YOUR USERNAME HERE"
mkdir ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t ed25519 -C "${my_username}@valhalla" -f ~/.ssh/key_to_valhalla #or ssh-keygen -t rsa -b 4096 -f ~/.ssh/key_to_valhalla
chmod 600 ~/.ssh/key_to_valhalla
chmod 644 ~/.ssh/key_to_valhalla.pub
ssh-copy-id -i ~/.ssh/key_to_valhalla.pub ${my_username}@valhalla
cat > ~/.ssh/config <<EOF
# Specific settings for a valhalla server
Host valhalla valhalla.wur.nl
HostName 10.124.35.35
User ${my_username}
IdentityFile ~/.ssh/key_to_valhalla
ServerAliveInterval 60
ServerAliveCountMax 2
Port 2222
Host *
AddKeysToAgent yes
EOF
```
After running the above command, try
```ssh valhalla```
A request to enter your passphrase to initiate a connection should follow. Otherwise, something went wrong with the commands above
### For Windows (MobaXterm)
If you are using the Windows Subsystem for Linux, follow the macOS and Linux steps above.
We recommend that Windows users work with MobaXterm. To generate an SSH key with MobaXterm, follow these steps:
1. Open MobaXterm.
2. Select 'Tools', then 'MobaKeyGen' from the menu.
3. Click 'Generate' to create a new key.
4. Select the key type: RSA or Ed25519. If you choose RSA, adjust the number of bits to 4096 or above.
5. Click 'Generate' and move the mouse until the key files are complete.
6. Change the comment to add a description that will allow you to easily identify the key.
7. Add a key passphrase and confirm it. The passphrase is different to the password you initially used to connect to the server. Each SSH key file has its own passphrase.
8. Click 'Save public key' and save the file somewhere only you can access. You can name the file "key_to_valhalla.pub", for example.
9. Click 'Save private key', then place the file in a location to which only you have access. You can name the file "key_to_valhalla".
10. You can now close the 'SSH Key Generator' dialog window.
Alternatively, it is possible to generate an SSH key via a local terminal in MobaXterm. This is how to proceed:
1. Open a local terminal in MobaXterm.
2. Create a folder to store the keys.
```
mkdir ~/MyDocuments/.ssh
```
3. Enter the command (You will be asked for passphrase),
```bash
my_username="PUT YOUR USERNAME HERE"
ssh-keygen -t ed25519 -C "$my_username@valhalla" -f ~/MyDocuments/.ssh/key_to_valhalla
```
After the key has been generated, the public key needs to be share with the server. Copy/Paste the command below in a local MobaXterm terminal.
```
ssh-copy-id -i ~/MyDocuments/.ssh/key_to_valhalla.pub ${my_username}@valhalla
```
This command will add the content of the local file '~/.ssh/key_to_valhalla.pub' to the file '~/.ssh/authorized_keys' on the server.
After this step, you can add the private key to the connection settings for valhalla. Remember that the passphrase for that key will be asked every time you log in, not your password
## Login to the server
The complete command to login to the server is,
* with ssh key
* ssh -i ~/.ssh/key_to_valhalla username@valhalla # You will be asked to enter your passphrase
* with ssh key and config file
* ssh valhalla # You will be asked to enter your passphrase
* without ssh key
* ssh username@valhalla # You will be asked to enter your password (This way is not recommended)
A repetitive failed attempt to login may lock your account for 2h, so think before typing in your password multiple time.
## Do you have any data to copy from Potato or Helicoprion or snellius?
For this part, make sure you can log in to the machine where your data lies then read the page [data transfer](../data-transfer)