Configuring SSH for Putty/FireFTP

Status
Not open for further replies.

Beran Muden

Cadet
Joined
Aug 2, 2014
Messages
5
Hello all,

For the last two months, I've been the proud owner of a FreeNAS box.
And although I work as an IT professional (Windows-minded), I've had quite some trouble setting up a safe FTP solution for my NAS. Even after doing the required RTFM and googling for a similiar solution, the steep learning process made it difficult for me to breeze through the setup.

But, the good news is I finally managed to pull of the FTP solution I wanted, in this case FTP through SSH. For those who are interested, I've made a small tutorial on how to properly configure SSH for a safe FTP solution which uses private/public keys. Since I cannot post in the "How-To Guides"-section, I've posted it here. If possible and if desired so by other users, perhaps this tutorial could be moved to the proper section.

Prerequisites:
- Generally know your way around FreeNAS (RTFM)
- Have access to Putty and the Putty generator.
This particular configuration was done on a FreeNAS-9.2.1.5-RELEASE-x64 setup.
See the bottom of the page for further information on that.

What to do:
- Open puttygen.exe
- Create a new SSH-2 RSA key with 2048 bits
putty1.PNG

- Enter a key passphrase to encrypt the key on disk (and confirm the same passphrase)
- Save the private key to disk. You will need this key on your client to connect to FreeNAS
- If you want, you can save the public key to disk, this is optional.
(You can also recover the public key by opening the private key in puttygen.exe)
- Copy the data from the field "Public key for pasting into OpenSSH authorized_keys file:"
putty2.PNG

- Paste the key into the "SSH Public Key" field from the user account on FreeNAS
FreeNAS-SSH2.PNG

- Turn on the SSH service on the FreeNAS, default settings and port 22
FreeNAS-SSH1.PNG


Putty:
The initial setup is now complete.
You're now able to connect to your FreeNAS with Putty while using a private and public key.
Make you sure you set the right private key .ppk file when connecting.
To do this, go to Connection > SSH > Auth and point to your .ppk file.
putty3.PNG


FireFTP:

What's even better, is that you can connect to your FreeNAS from the internet, while using Firefox and the FireFTP addon. When connecting to your FreeNAS while using FireFTP, please consider the following settings:

On the Main tab
- In the ID field, enter the username of a FreeNAS user to make the connection
- For the password, use the passphrase of the private key!
FireFTP1.PNG


On the Connection tab
- Select SFTP with port 22 as connection type
- Select your private key .ppk file created earlier with puttgen.exe
FireFTP2.PNG


That's it.

Notes:
The private key should be stored in a file that only you can access, and the key should be encryped with a passphrase for added security. If this is not possible, do not use public key authentication.

For reference see the following sites:
http://doc.freenas.org/index.php/SSH
http://www.ualberta.ca/CNS/RESEARCH/LinuxClusters/pka-putty.html
http://kb.site5.com/shell-access-ss...-keys-and-connect-to-your-account-with-putty/

Hopefully this guide may help someone else stuck with SSH and FTP.
If not, feel free to delete this post.

Regards,

BM.
 

Yatti420

Wizard
Joined
Aug 12, 2012
Messages
1,437
This should be in how to.. As a side note you shouldn't be on port 22 (externally).. redirect something like 8888 to 22 if you must in your router just beware of security risks.. albeit minimized using keys..

The alternative to not using keys is password based authentiation which is a big risk security wise..
 

DrKK

FreeNAS Generalissimo
Joined
Oct 15, 2013
Messages
3,630
This is an important point, what @Yatti420 is saying. *DO NOT* expose port 22 directly. Expose ANOTHER port, and have it forward to 22. As soon as the hacker daemons that crawl the internet see that you have a port 22 open, they'll pound the shit out of it. And even if they don't get in, it's still not good.
 

Yatti420

Wizard
Joined
Aug 12, 2012
Messages
1,437
Yea you will get emails 4-5 pages long.. I have a server I still haven't changed and everynight I get an email a 3am for security.. If you want even more protection you could intergrate fail2ban or denyhosts for some extra punch but changing ports is a must.. FreeNAS isn't designed for external use so if you do expose it it's doing so at your own risk.. It's why FreeNAS ships with no gateway etc so nothing gets out..
 

Beran Muden

Cadet
Joined
Aug 2, 2014
Messages
5
As a side note you shouldn't be on port 22 (externally)

Good point.
I left the whole router configuration out on purpose, but if this post gets moved, I'll make sure to put it in there.

Thanks for the feedback!
 
Status
Not open for further replies.
Top