225
edits
No edit summary |
No edit summary |
||
| Line 6: | Line 6: | ||
===Creating the Key=== | ===Creating the Key=== | ||
First of all, you will need to create your secret key which will remain on the machine you are ssh'ing from. This is done by typing: | First of all, you will need to create your secret key which will remain on the machine you are ssh'ing from. This is done by typing: | ||
ssh-keygen -t | ssh-keygen -t ed25519 -b 2048 | ||
This will generate the public and private keys. You will be asked where you wish to store the key. Just press enter to accept the default location. | This will generate the public and private keys. You will be asked where you wish to store the key. Just press enter to accept the default location. | ||
| Line 12: | Line 12: | ||
===Copying the Key to Redbrick=== | ===Copying the Key to Redbrick=== | ||
Now you will then need to copy your public key (~/.ssh/ | Now you will then need to copy your public key (~/.ssh/id_ed25519.pub) to the server you wish to ssh to. Redbrick's machines have a common home directory so you only need to transfer your ssh-key once. | ||
Two options for transferring your key are outlined bellow; | Two options for transferring your key are outlined bellow; | ||
====Option 1==== | ====Option 1==== | ||
ssh-copy-id -i ~/.ssh/ | ssh-copy-id -i ~/.ssh/id_25519.pub username@login.redbrick.dcu.ie | ||
This will append your key to your authorized_keys file on redbrick. | This will append your key to your authorized_keys file on redbrick. | ||
| Line 23: | Line 23: | ||
====Option 2==== | ====Option 2==== | ||
scp ~/.ssh/ | scp ~/.ssh/id_ed25519.pub username@login.redbrick.dcu.ie:.ssh/ | ||
This will put the file in the ~/.ssh folder of your account on the machine you want to ssh to. | This will put the file in the ~/.ssh folder of your account on the machine you want to ssh to. | ||
| Line 30: | Line 30: | ||
ssh username@login.redbrick.dcu.ie | ssh username@login.redbrick.dcu.ie | ||
You will still be prompted for a password at this stage. Once you are on other machine, you need to move into the .ssh directory cd .ssh. You will have to add the line in the | You will still be prompted for a password at this stage. Once you are on other machine, you need to move into the .ssh directory cd .ssh. You will have to add the line in the id_25519.pub into the authorized_keys file. The easiest way to do this is to simple cat the id_25519.pub and put the results into the authorized_keys file i.e: | ||
cat | cat id_25519.pub >> authorized_keys | ||
Once all that is done, then all that remains to do is to remove the | Once all that is done, then all that remains to do is to remove the id_25519.pub on the machine you wish to ssh to rm ~/.ssh/id_25519.pub. | ||
===Changing your Passphrase=== | ===Changing your Passphrase=== | ||
From time to time you may wish to change the passprhase on your ssh-key. To do this run the following command | From time to time you may wish to change the passprhase on your ssh-key. To do this run the following command | ||
ssh-keygen -f ~/.ssh/ | ssh-keygen -f ~/.ssh/id_25519 -p | ||
It will prompt you for your current passphrase. Once you have typed your current passphrase it will ask you for a new passphrase. You will then be asked to re-enter it to validate it. | It will prompt you for your current passphrase. Once you have typed your current passphrase it will ask you for a new passphrase. You will then be asked to re-enter it to validate it. | ||
| Line 44: | Line 44: | ||
==Windows SSH-Keys with Putty== | ==Windows SSH-Keys with Putty== | ||
You will need to open the Key Generator program | You will need to open the Key Generator program which should automatically install alongside putty. | ||
This is what will generate the public and private keys. | This is what will generate the public and private keys. | ||
When the program loads up, you will be faced with a a small number of options on the the base of the screen. Select | When the program loads up, you will be faced with a a small number of options on the the base of the screen. Select ed25519 as the key type. Select 2048 for the number of bits. When you have filled in this information, click on "Generate". | ||
You will be asked to move the mouse around the blank space on the screen. The more you move the mouse, the more random the keys will be. It will generate the keys straight away. You can then enter a passphrase (if you wish) and then confirm it by typing it again. Then click "save private key" to save this key. You will be asked to give the program a destination folder to save the key to and you will need to give it a filename. Do the same for "save public key". | You will be asked to move the mouse around the blank space on the screen. The more you move the mouse, the more random the keys will be. It will generate the keys straight away. You can then enter a passphrase (if you wish) and then confirm it by typing it again. Then click "save private key" to save this key. You will be asked to give the program a destination folder to save the key to and you will need to give it a filename. Do the same for "save public key". | ||