[[fester:ssh_setup]]

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
fester:ssh_setup [2016/06/11 16:14] – [Using SSH on a Mac] danfester:ssh_setup [2017/06/29 11:42] (current) – [Configuring the connection] dan
Line 8: Line 8:
  
 ===== Configure SSH in FreeNAS ===== ===== Configure SSH in FreeNAS =====
 +
 +Open your web browser and type in the IP address of the FreeNAS web GUI that you noted down earlier (Fester used 192.168.0.58).
 +
 +The web GUI will present itself and ask for the login details. Enter the username which is **root** (1) and your password (2) and click the “Log In” button (3).
 +
 +{{:fester:4546365f86b7b6a07f1bd4625a420f41.png}}
 +
 +Now you are logged into FreeNAS.
 +
 +  * Now navigate to the “Services” page (1).
 +  * Click on the tiny spanner icon next to “SSH” (2).
 +  * If you do not want the root user to be able to log in using only a password (i.e., if you want to require a public key, or if you don't want the root user to be able to log in remotely at all), uncheck the “Login as Root with password” tick box (3).
 +  * If you want to require public key authentication, uncheck the “Allow password authentication” tick box (4).
 +  * Make sure the remaining tick boxes are unchecked (5).
 +  * Now click the “OK” button (6).
 +
 +{{:fester:647972c64ceada196469d6534ed658b3.png}}
 +
 +Now turn on the SSH service.
 +
 +{{:fester:3d011781aafeb935e90e626a3467e320.png}}
  
 ===== Specify SSH Public Key For a User ===== ===== Specify SSH Public Key For a User =====
 +
 +If you have required public key authentication in the SSH configuration, you'll need to tell FreeNAS what the public key is for each user who will be connecting via SSH. To do that, Navigate to the “Account” page by clicking on the Account icon (1). Now click on the “Users” button (2).
 +
 +{{:fester:66e90c4c7eff16fe31f901188c5fa71c.png}}
 +
 +Now select the “root” user account (1) (it will turn blue when selected) and click on the “Modify User” button (2).
 +
 +{{:fester:cb56ce7ed62559242f0ad951c5b75c0b.png}}
 +
 +The modify user window should now pop up. Scroll down till you come across the “SSH Public Key:” entry (1).
 +
 +Now right click in the blank box next to it and paste in the previously copied public key (2).
 +
 +Now click the “OK” button (3).
 +
 +{{:fester:d2c38fb0b46a57606ca2906c017b5831.png}}
  
 ===== Setting up PuTTY in Windows ===== ===== Setting up PuTTY in Windows =====
Line 16: Line 53:
  
 ===== Public Key Authentication in PuTTY ===== ===== Public Key Authentication in PuTTY =====
 +
 +Switch on and boot up a personal computer that is part of your private network (if you use it to connect to the internet then this will probably work).
 +
 +Download PuTTY and PuTTYgen to your personal computer (not the server).
 +
 +Install PuTTy and PuTTYgen under an administrator’s account or right click on their respective installation programs and run as an administrator.
 +
 +==== Generating the keypair ====
 +
 +When installed run PuTTYgen under an administrator’s account or right click on the program and run as an administrator.
 +
 +When the PuTTYgen window appears check “SSH-2 RSA” is selected (1), if it isn’t select it.
 +
 +Next check the “Number of bits in a generated key:” is set to 2048 (2).
 +
 +Now click the “Generate” button (3).
 +
 +{{:fester:18ffc8b3f1e27ef37341321c53be2579.png}}
 +
 +Now move your mouse in a random way within the box labelled “Key” (1) in PuTTYgen until the green bar fills up (2).
 +
 +{{:fester:313e3f2dee8179c9f6075fbdbc697226.png}}
 +
 +When the green bar is full the key will be generated and a new screen will appear.
 +
 +In the “Key comment” text box (1) type a comment which will help you identify the key.
 +
 +Now type in a password for the private key in the “Key passphrase” text box (2), remember it as this will be needed later (Fester just used **test** again).
 +
 +Retype the password into the “Confirm passphrase” text box (3).
 +
 +Now save the private key by clicking on the “Save private key” button (4).
 +
 +An additional window will pop up, navigate to where you would like to save the key, give it a name (5) and click the “Save” button (6). Save it somewhere convenient as this will be needed soon.
 +
 +Now right click in the “Public key for pasting into OpenSSH authorized_keys file:” window (7) and from the pop up submenu chose “Select All” (8).
 +
 +The text within this window should become highlighted. Now right click again in this window as you did a moment ago and from the pop up submenu this time select “Copy”.
 +
 +{{:fester:624d5ddaee04c599cc9d7a8a3aef67df.png}}
 +
 +{{:fester:a305a7a81bbd1bf1b9b12a4cdd9bf082.png}}
 +
 +==== Configuring the connection ====
 +
 +Now run PuTTY under an administrator’s account or right click on it and run as an administrator.
 +
 +In the “Host Name or (IP address)” box (1) type in the IP address of the FreeNAS web GUI (Fester’s was 192.168.0.58).
 +
 +Check the port number in the “Port” box (2) is set to 22.
 +
 +The “Connection type:” should be set to SSH (3).
 +
 +Now in the “Category” window click the small plus symbol “+” next to SSH (4). This should open up this section to reveal subcategories.
 +
 +Then click on “Auth” (5), not the “+” sign but the actual text itself.
 +
 +{{:fester:682b107a46081e78692b0d0a56b58a63.png}}
 +
 +This should take you to a different screen.
 +
 +On this screen click the “Browse” (1) button next to the “private key file for authentication:” (2).
 +
 +{{:fester:75a6170bf5395d095a4a523c99a94746.png}}
 +
 +This will bring up a window in which you can load in the private key into PuTTY. Navigate to where you stored the private key, click on it and then click the “Open” button.
 +
 +{{:fester:937aa3d832bb41ca7dbd57d8c83a7fcc.png}}
 +
 +With the key now loaded in, go back to the “Session” category in the “Category” window (1).
 +
 +It is possible to save the settings of this session. This is a good idea because otherwise we would need to re-enter all the details each time we wanted to start a session in PuTTY.
 +
 +In the “Saved Sessions” box (2) type a good name for the session (Fester called it “HDD Validation SSH”).
 +
 +Now click on the “Save” button (3). The saved session should now appear in the window to the left of this (4).
 +
 +Now click on the “Open” button (5) to start the session (have the password you created in PuTTYgen standing by).
 +
 +{{:fester:855b55319b9478882150ad7d77282212.png}}
 +
 +A PuTTY security alert window should now open. It will show the server’s RSA2 key fingerprint and will ask if you trust this host before allowing the connection. Click the “Yes” button.
 +
 +{{:fester:5fccef248c0ccad4d3cb3b950af3da65.png}}
 +
 +(There is a way to check this by using the RSA2 fingerprint but I can’t remember how, if someone lets me know I will try to include it in the guide or you could replace this or any section with your own?)
 +
 +You will now have access to the PuTTY session as soon as you login. Type the username next to the “Login as:” text (1). In this case it is **root**.
 +
 +Next you will be asked for the password you created in PuTTYgen. Type it in next to the “Passphrase for key "Test SSH":” text (2) (Fester used **test**).
 +
 +As you type the password the text will not appear on the screen, this is normal and a security feature.
 +
 +{{:fester:3955a477aaad5f7ea7e51fdcd30939c6.png}}
 +
 +To leave the SSH console just type **exit** and the session along with the window will close.
 +
 +That’s the SSH console configured in FreeNAS.
 +
  
 ===== Using SSH on a Mac ===== ===== Using SSH on a Mac =====
Line 62: Line 198:
  
 ===== Using SSH on Linux ===== ===== Using SSH on Linux =====
 +
 +SSH on Linux works just like SSH on a Mac.  Follow the instructions above.
  
  • fester/ssh_setup.1465661660.txt.gz
  • Last modified: 2016/06/11 16:14
  • by dan