You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long. 5.2 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. SSH-Keys are used to allow passwordless access to a machine. It uses an
  2. unique host key to identify who you are.
  3. To use this you will need to have ssh on your current machine.
  4. ## Linux SSH-Keys
  5. ### Creating the Key
  6. First of all, you will need to create your secret key which will remain
  7. on the machine you are ssh\'ing from. This is done by typing:
  8. `ssh-keygen -t dsa`
  9. This will generate the public and private keys. You will be asked where
  10. you wish to store the key. Just press enter to accept the default
  11. location.
  12. You will then be asked for a passphrase. A passphrase will help to stop
  13. people who get access to your console getting access to different
  14. accounts. Its basically to help make it more secure. Once you have
  15. entered your passphase , you will be asked to re-type your passphrase.
  16. You can just just press enter if you don\'t want to use a passphrase.
  17. ### Copying the Key to Redbrick
  18. Now you will then need to copy your public key (\~/.ssh/ to
  19. the server you wish to ssh to. Redbrick\'s machines have a common home
  20. directory so you only need to transfer your ssh-key once.
  21. Two options for transferring your key are outlined bellow;
  22. #### Option 1
  23. `ssh-copy-id -i ~/.ssh/`
  24. This will append your key to your authorized_keys file on redbrick.
  25. #### Option 2
  26. `scp ~/.ssh/`
  27. This will put the file in the \~/.ssh folder of your account on the
  28. machine you want to ssh to.
  29. You will need to log in to the machine you want to ssh to. Just use ssh
  30. as you normally would for the moment:
  31. `ssh`
  32. You will still be prompted for a password at this stage. Once you are on
  33. other machine, you need to move into the .ssh directory cd .ssh. You
  34. will have to add the line in the into the authorized_keys
  35. file. The easiest way to do this is to simple cat the i and
  36. put the results into the authorized_keys file i.e:
  37. `cat >> authorized_keys`
  38. Once all that is done, then all that remains to do is to remove the
  39. on the machine you wish to ssh to rm \~/.ssh/
  40. ### Changing your Passphrase
  41. From time to time you may wish to change the passprhase on your ssh-key.
  42. To do this run the following command
  43. `ssh-keygen -f ~/.ssh/id_dsa -p`
  44. It will prompt you for your current passphrase. Once you have typed your
  45. current passphrase it will ask you for a new passphrase. You will then
  46. be asked to re-enter it to validate it.
  47. The next time you connect to redbrick it should use this new passphrase.
  48. ## Windows SSH-Keys with Putty
  49. You will need to open the Key Generator program usually located in the
  50. same menu as Putty.exe. If you do not have this program, you can
  51. download it from:
  52. [``](
  53. This is what will generate the public and private keys.
  54. When the program loads up, you will be faced with a a small number of
  55. options on the the base of the screen. Select DSA as the key type. It
  56. will automatically select 1024 for the number of bits but you can change
  57. this number to whatever you want. When you have filled in this
  58. information, click on \"Generate\".
  59. You will be asked to move the mouse around the blank space on the
  60. screen. The more you move the mouse, the more random the keys will be.
  61. It will generate the keys straight away. You can then enter a passphrase
  62. (if you wish) and then confirm it by typing it again. Then click \"save
  63. private key\" to save this key. You will be asked to give the program a
  64. destination folder to save the key to and you will need to give it a
  65. filename. Do the same for \"save public key\".
  66. Now once you have saved your keys, press \"Load\". If you gave it a
  67. passphrase, you will need to type it in now. At the top you will see the
  68. public key that you will need to copy in to your authorised keys.
  69. Highlight it and right click and select copy. Then you\'ll have to log
  70. on to the server you wish to be able to ssh easily too. You will need to
  71. go to putty.exe.
  72. You will still be prompted for a password at this stage. Once you are on
  73. other machine, you need to move into the .ssh directory cd .ssh. You may
  74. need to create a authorized_keys file by doing the following :
  75. `touch ~/.ssh/authorized_keys`
  76. Then all that is left to do is to put the public key into the
  77. authorized_keys file.
  78. `cat >> authorized_keys`
  79. You should still have the public key in your buffer, if not just copy it
  80. again from the top of the Key Generator program. Just right click on
  81. your terminal and you will see it being printed onto the screen. Then
  82. hit Ctrl\^D.
  83. Now when you run putty.exe, all you have to do is go to
  84. connection:<SSH:Auth> and click on \"Browse\" to tell putty where your
  85. private key is. You can save your settings so you don\'t have to do this
  86. everytime. Now when you log in you will either get in without a password
  87. or only have to give your passphrase. Don\'t forget to reload the
  88. private key in the key generator next time you log on to your computer.
  89. If you have any problems or something just won\'t work for you, just
  90. mail or hey a member of helpdesk and they\'ll sort it out for ya :-)
  91. [Category:Helpdesk](/Category:Helpdesk "wikilink")