you’re reading...

Programming

Open SSH Authentication with Cygwin and Putty

Your Ad Here

Secure shell authentication (SSH Authentication) can be used by client to connect to a server remotely with encryption enabled. SSH or secure shell access offers a convenient way to access the servers terminal securely, however it becomes annoying if we need to type the password every time we need to connect to a server especially if we have a strong password in place. Doing it automatically offers a convenient and secure way to access our servers.

We can do this using OpenSSH if you have a Linux machine or Mac then by no means you already have it in your system. This article focus primarily in using OpenSSH via Windows machine, I just included the Cygwin to do this but it can also be done by using Putty alone.

So to start with, lets define what do we mean:

* Client: the system one types directly on, such as a laptop or desktop system.

* Server: anything connected to from the client.

Some precautions don’t allow your root account to do this, you can always run sudo command to perform administrative task. To do this of just add a user to the wheel group in Linux system to allow them to become
sudoers.

Let’s begin:

1. Run Cygwin in your command prompt then check the version of OpenSSH installed in your system:
by by typing $ ssh -V

ssh version

2. Run ssh-keygen to generate the private/public key pair if you are in Windows then it will save the copy of the keys under the account you are using in C:/Documents and Settings/Your_Account/.ssh/id_rsa (for the private key file) and id_rsa.pub (for the public key file)

ssh-keygen

3. Upload your public key in the server by typing $ scp ~/.ssh/id_rsa.pub server.example.org
then set up the public key in your server

4. To do this create an .ssh directory in your folder in the server. This ~ symbol is an alias for your home directory

4.1 – server$ mkdir ~/.ssh >>> this creates a hidden .ssh directory in your home folder

4.2 – server$ chmod 700 ~/.ssh >>> make sure to set the file permission to 700

4.3 – server$ cat ~/id_rsa.pub >> ~/.ssh/authorized_keys >>> authorized your keys

4.4 – server$ chmod 600 ~/.ssh/authorized_keys >>> then set the file permission to 600 sometimes ssh will refuse connection if the file permission is too loose this is also useful to make sure to make sure that you are the only one who have access to your keys.

4.5 – server$ rm ~/id_rsa.pub >>> remove the copy of your public key from your home folder.

Then everything is ready lets test our connection if you do it correctly:
in cygwin type $ ssh username@example.com -p 22 then it will prompt for your pass phrase. You can put a blank pass phrase but that is not advisable.

If that is working let’s setup putty to login automatically

1. Open Puttygen then load your private key file it will prompt you for your pass phrase save this as id_rsa.ppk, ppk us the default filename for putty’s private key file.

Loading Private key

Loading Private key

2. Next Open Putty pageant and load your private key file to achieve automatic login via putty.

Load Key

Load Key

3. In putty set up your session by typing the details of your server then go to SSH and select Auth browse for your private key file generated by puttygen and load it save this session profile before connecting.

Putty Profle

Putty Profle

4. If you do it correctly then you will get this login prompt when connecting to your server:
First it will ask you of your username, and after typing it will automatically log you in using your generated keys for authentication.

Server Login Prompt

Share

Discussion

No comments for “Open SSH Authentication with Cygwin and Putty”

Post a comment

You must be logged in to post a comment.

Categories

Register/Login

Register and Participate

Registration to this website is free. Feel free to use and explore the features of the website. You are welcome to participate and interact with us in the forum. If you have concerns that you want us to know you can easily contact us using this link. By registering in this website, your account will allow you to login and participate in the forum and to access additional information that is only available to registered users. We are keeping this website to be informative for us and to our users.

Syndication

feeds


There was an Analytics API service error 403: Error calling GET https://www.googleapis.com/analytics/v3/management/accounts/468110/webproperties/UA-468110-5/profiles: (403) User does not have sufficient permissions for this account.Error - Account ID is blank
0
Unique
Visitors
Powered By Google Analytics