Generate SSH public-private key pair in Windows
We recently set-up a nice server environment for one of our newer clients. Like all our other servers, we made it accessible only via authorised key-pairs. Yes, there are no passwords to access
that server. It can only be accessed by authorised keys. We had to explain our client why it is a more secure method and how it also makes it easy to control who accesses their server. During the process we realised that this method is still not
widely used, so we thought we would write a quick post about it this week.
Our developers have to access files and database of live and under-development projects hosted on remote servers on daily basis while working on their projects. Many of our clients or client-side managers are tech-savvy and hence like to access the
servers which host their websites and webshops. There are even occasions when you have to give server access to external parties like module-makers or third-party auditors. You cannot create a new server user everytime a new person needs to access a
server. Not only is it alot of unnecessary work but it can get tricky if you create too many server users and they are all used to update, upload or delete files. That can create problems with permission and file ownership very quickly. And then
there is the big issue of changing passwords regularly (for security reasons) and then keeping everyone informed about the latest one.
Our solution to this problem? All our servers have a key-based access! Each member of our team has their own private key and they are provided access to projects by adding their public key to respective server which hosts that particular project.
Once their work is done, their public key is removed from the server and hence they cannot access it anymore. The same process is applied when we have to provide server access to external parties as well. We add their keys when needed and remove it
as soon as their part is done. This way same server user can be provided to multiple people and still only authorised users can use it at any given time. This also means that every one who wants to access the server has to generate their public and
private key pairs. Their public keys should also be added to the server by administrator and then they have to use their private key to login to the server.
Since Windows is most popularly used OS on official computers, we will explain how you can generate your public-private ssh key-pair on a Windows machine. Note that there is still no native application to support SSH in Windows, but they have been
working on it for some years now. For now, you can easily download Putty and use it as a way to establish a Secure Shell (SSH) connection to your server.
GENERATE A PUBLIC-PRIVATE KEY PAIR
There are a few ways to create SSH keys in Windows but we will tell you the easiest and friendliest one in this post.
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
That is it. You now have a pair of public and private keys. Public key will be added to the server so that it can recognise you, and you should use the private key part so that you can tell the server that it is you.
USE YOUR PRIVATE KEY TO LOGIN TO THE SERVER
Once the server admin has added your public key to the server, you can login to the server using tools like Filezilla or Putty.
Steps to access server using Filezilla:
- Enter the server IP in host field under 'General' tab.
- Select 'Logon Type' as 'Key file'
- Enter your server username in 'User' field
- Click on browse button and navigate to the location where your private key file is saved at your local machine and select it.
- Click on Connect.
- It will ask you to enter Passphrase if you had added one while creating the private key.
To access the server using PuTTY, you should go through following steps:
| |
| |
| |
| |
| |
|
At Hungersoft, we not only do what is asked for, but also go beyond and help our customers do everything that is right and secure for their setup. Feel free to contact us for all your server setup,
optimization, security and hosting needs.