Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
  1. First, generate an SSH Key on your local client machine.

    1. On a PC

      1. Using command prompt (cmd):

        1. On your Local PC: Open a command prompt and run the following command: ssh-keygen

        2. On your Local PC: This should create a public/private rsa key pair. You will be prompted for a location in which to save your key pair. The default will be C:\Users\<your_computer_acct>\.ssh\id_rsa. This should be fine as long as you don't have other id_rsa files you use. (If you do, you may want to consider naming the file something else, like 'loren_rsa' to distinguish it from other keys.). To use default (id_rsa), hit enter.

        3. On your Local PC: Leave the passphrase empty unless you prefer to have one. (You will need to enter this every time you ssh to Loren if you create one).

        4. On your Local PC: Change directories to your C:\Users\<your_account>\.ssh on your local computer/client with the cd command. Example: cd C:\Users\<your_account>\.ssh.

        5. On your Local PC: View the content of your public key with the following command where id_rsa.pub is the public key file: type id_rsa.pub

        6. On your Local PC: Copy the contents of your public key file, then connect via ssh into loren normally with your normal credentials. Ex: ssh <username>@loren.uwyo.edu At this point, in the cmd prompt, you are on Loren. You can determine “where” you are based on your prompt. If you are on loren, you’re prompt will reflect that with: [your_username@lorenlog1 ~]$

        7. On Loren: Once logged into Loren, you should automatically be logged in on your profile and your current directory should be your home directory by default unless you change it in your configurations. Unless you’ve already created one previously, you will not have a .ssh directory on Loren, so you will need to create it. You may do that with mkdir ~/.ssh

        8. On Loren: Once your .ssh directory is created, change directories to your .ssh directory on Loren with: cd ~/.ssh

        9. On Loren: Here we will want to create a new file called authorized_keys. On Loren, we can do this with the following command in vim which will create an empty file, in which we can add content: vim authorized_keys. This puts us into a text editor and empty file.

        10. On Loren: Hit the i button on your keyboard to insert text into the file.

        11. On Loren: Paste the content of your public key from your local computer to the file on Loren by hitting ctrl+p on your windows keyboard.

        12. On Loren: Save content by hitting Esc on your keyboard, then type :wq! into the bottom of the file (which signifies we’re writing the content and then quitting the program) then Enter on your keyboard.

        13. On Loren: Now set the permissions for the file to only be readable with the following command: chmod 600 authorized_keys

        14. On Loren: Now get out of the folder by running cmd: cd ..

        15. On Loren: Lastly, we want to update permissions for our .ssh folder so it’s only writable by us: chmod 755 .ssh

      2. Using Putty:

        1. On your Local PC: Launch PuttyGen by typing it into your windows start menu search box. You should be presented with the following screen:

        2. On your Local PC: Click Generate to generate a public/private key pair. You’ll be prompted to move your mouse to introduce randomness to create the key. Do that. Once the key is created, click “Save public key” and “Save Private Key”. Note where you save each file.

        3. On your Local PC: Copy the content of the SSH public key in the text box underneath Public Key for pasting into OpenSSH authorized_key file.

        4. On your Local PC: SSH into loren normally, with your normal credentials. Ex: ssh <username>@loren.uwyo.edu At this point, in the cmd prompt, you are on Loren. You can determine “where” you are based on your prompt. If you are on loren, you’re prompt will reflect that with: [your_username@lorenlog1 ~]$

        5. On Loren: Once logged into Loren, you should automatically be logged in on your profile and your current directory should be your home directory by default unless you change it in your configurations. Unless you’ve already created one previously, you will not have a .ssh directory on Loren, so you will need to create it. You may do that with mkdir ~/.ssh

        6. On Loren: Once your .ssh directory is created, change directories to your .ssh directory on Loren with: cd ~/.ssh

        7. On Loren: Here we will want to create a new file called authorized_keys. On Loren, we can do this with the following command in vim which will create an empty file, in which we can add content: vim authorized_keys. This puts us into a text editor and empty file.

        8. On Loren: Hit the i button on your keyboard to insert text into the file.

        9. On Loren: Paste the content of your public key from your local computer to the file on Loren by hitting ctrl+p on your windows keyboard.

        10. On Loren: Save content by hitting Esc on your keyboard, then type :wq! into the bottom of the file (which signifies we’re writing the content and then quitting the program) then Enter on your keyboard.

        11. On Loren: Now set the permissions for the file to only be readable with the following command: chmod 600 authorized_keys

        12. On Loren: Get out of your .ssh folder so we can make changes to it’s permissions by typing cd ..

        13. On Loren: Lastly, we want to update permissions for our .ssh folder so it’s only writable by us: chmod 755 .ssh

        14. On your Local PC: Open Putty. You should be taken straight to a Putty configuration screen.

        15. On your Local PC: Configure your session in Sessions and enter loren.uwyo.edu as the Host name leaving default ports and SSH as the connection type.

        16. On your Local PC: Go to Connection->Data and under Auto-login username type in your username for Loren (usually this is the same as your UWYO username)

        17. On your Local PC: Go to Connection->SSH->Auth->Credentials. You will be presented with this screen:

        18. On your Local PC: Browse to the private key file for authentication. (If you created it in the default location this will be at C:/Users/<your_username>/putty.ppk).

        19. On your Local PC: Now go to SSH->X11 and Enable X11 Port Forwarding.

        20. On your Local PC: Go back to sessions and save this session configuration with a name you’ll remember and click the Save button.

        21. On your Local PC: Click Open to begin your session with the server. If you saved your SSH private key with a passphrase, you will now be prompted to enter that passphrase. An alert displays indicating that the server’s host is not cached. Click Yes, to continue the connection.

        22. On your Local PC: You should no longer be prompted for a password if this was configured correctly.

...