SSH Keys for FileZilla and Putty in Cpanel - SSH Server Private and Public Keys
(Page 2 of 2 )
Step2: Saving Both the Private Key and Public Key
Private key and public keys are highly important information that you need to store. By default, any information on your hard drive can be read by any malicious software because it is not encrypted by default.
The recommended method to store private key and public keys are inside an encrypted section of your hard drive. This can be easily accomplished by using TrueCrypt: http://www.truecrypt.org/. You can read their easy tutorial here: http://www.truecrypt.org/docs/?s=tutorial. The good thing about TrueCrypt containers - aside from the information being encrypted - is that it also protects with passwords for increased security.
Once you have installed TrueCrypt successfully and created a TrueCrypt container, follow the steps below:
1.) Create a folder in one of your TrueCrypt container and name the folder as “keys”.
2.) Under “Public Key for pasting into OpenSSH authorized_keys file:” in the Putty Key Generator tool (see previous screenshot). Copy the public key generated and put it in a text editor such as Notepad or Gedit. Save the file as public_key and save it to the “keys” folder in your Truecrypt container. Do not put any extension after it.
3.) Now under in the Putty Key Generator tool, enter your desired “Key passphrase” and re-enter it in “Confirm passphrase”.
The recommended keyphrase is easy (one word for example). It is because this makes it easy for you to type and remember when using it with a command line method like Putty. This will eliminate the possibility of experiencing difficulty in copying and pasting passphrase in Putty during login.
4.) Next is to click “Save Private Key” under Actions.
5.) Save it in the “keys” folder in your TrueCrypt container. Assign a file_name: private_key or something descriptive.
6.) You can now safely close the Putty Key Generator after saving all the keys.
Step3: Install Public Key to Remote SSH Server
1.) In this tutorial, let's use Cpanel. Login to your Cpanel hosting account.
2.) Under “Security” click “SSH/Shell Access”.
3.) Click “Manage SSH Keys”.
4.) Click “Import Key”.
5.) Type a descriptive name of the key. For example publicSSHkey
6.) Do NOT enter anything under “Paste the Private key in this box”. Instead you will only use the “Paste the Public Key in this box”.
7.) Go to “keys” folder in your encrypted hard drive. Open text file that contains your public key. Copy and paste it to the “Paste the Public Key in this box”. See screenshot:
8.) Click “Import”.
9.) Click “Go back” to see “Manage SSH Keys”.
10.) Under “Public Keys”. Click “Manage Authorization” link besides the public key you have just imported.
11.) Click “Authorize”. When you see again your public key entered under “public keys”, it should now be marked as “authorized” under “Authorization status”. The public key is now successfully installed in your remote SSH server.
STEP4: Connect to Remote SSH server Using Your Private key
For Putty (command line SSH method):
1.) Download Putty SSH client here: http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe
2.) Launch Putty. Click “Session” category to configure your SSH connection. Enter the SSH hostname, SSH port and under “Connection type”, select “SSH”. This is usually provided by your web hosting company.
3.) Under “Category”, look for SSH then expand it until you can see “Auth”. In the “Private key file for authentication”, browse to the “keys” folder in your TrueCrypt container. See screenshot below:
4.) Finally click “Open” to start the connection.
5.) Putty will ask for your SSH username to confirm. So type it. This procedure may vary depending on your hosting company.
6.) It will then ask for your private key passphrase. Since it is simple and not complicated unlike when using a password, you can easily type it.
7.) The remote SSH server will then acknowledge that you have successfully connected to the server and give you the bash prompt.
For Filezilla (GUI method):
1.) The concept of implementation is similar to Putty, launch Filezilla and define the SSH connection parameters to the remote server. This is found in the Site manager.
2.) Then go to Settings, under “Connection”, select “SFTP”.
3.) Under “Public Key Authentication”, click “Add Keyfile” and add your SSH private key file located in your encrypted drive.
If you see a warning “Convert keyfile” just click “Yes”. The primary reason is that Filezilla does not yet support password protected keyfiles at the time this tutorial has been written. Save it to the same “keys” folder folder and assign a unique name. Do not overwrite the private key file with a passphrase. It will then be added under “Private keys” then click OK.
4.) You can then start connecting with SSH server.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |