How to copy the public key of putty to server, if the server is my router


#1

hi, i use putty for my ssh session. And to be more secure for remote connection to servers, the putty has introduced public key and private key authentication.While i know, how to generate both the keys, i do not know, how to copy the public key for authentication purpose. There are instructions to copy the public key to server. Which server, they mean , i do not know.
I am using windows 7 and how to copy the publick key to my server, is the confusing part of it.
i just use my router for the ssh session and how to proceed further is in doubt.
While it will verify the private key to capture the public key for access security, how this could be saved in a server. I do not have any server, but only a client computer, an individual pc.
If any advice of how to do will be appreciated.
Which server , remote server, if it is router, how to copy the public key to the server.
if anyother doubt arise, i will query further. May i expect a detailed reply from experts
Here in the link, there are some instructions (pint no 6(to copy public key to the server
how to do in my windows login
Especially the command, where i have to type etc please clarify


#2

Could some experts answer? Some points in the link is not clear to me. Especially the point no. 6.


#3

The server for which you generated the key. You need a seperate key pair for each server you use. You create a key pair for that specific server and then copy that specific key to that specific server.

The instructions in step 6 are pretty clear for someone familiar with *nix OS systems but not for those less familiar with them so here’s a slightly expanded version of those instructions.

Then log in to your SSH server (if you have closed the previous SSH session already), still with the username and password,

Log into the SSH server with your username & password.

and paste the public key into the file ~/.ssh/authorized_keys2 (in one line!) like this:

That is just a description of what the following commands do.

mkdir ~/.ssh

Type this command line into the SSH session to create a subdirectory that will hold the public key.

chmod 700 ~/.ssh

Type this command line into the SSH session to set the permissions of the sub-directory that you just created.

vi ~/.ssh/authorized_keys2

Type this command to create a blank file named authorized_keys2 in the directory you created and have it open in the text editor named vi.

ssh-rsa AAAAB3NzaC1yc2EA[…]Lg5whU0zMuYE5IZu8ZudnP6ds= myname@example.com

This shows the public key that was just copied and is meant to tell you to paste it into the the vi text editor. To paste from the clipboard into a SSH session in PuTTY you position the cursor where you want the text in the file and then click the middle mouse button (press down on the scroll wheel). If you do not have scroll wheel/middle mouse button there is a PuTTY setting to make paste use the right button (the setting is under Windows -> Selection)

Then you need to save the file and exit the vi text editor. It’s been more than a decade since I used vi so I can’t recall the key sequence to do that. The following web page seems to have accurate instructions:

That file must be write/readable only by that user, so we run

chmod 600 ~/.ssh/authorized_keys2

That last part of step 6 should be completely clear.


#4

Hi, Paul,
Nice to have a reply from you. Yes i am not exposed to nix os.
If the server i am attempting is a router, then how to proceed?
I am having a pc only and not a server. To know the router statistics, i attempted the ssh connection thro software.
The router , is accessed with ip, and i use my router as my server.
If suppose, i make dir in the server login prompt, that is $ in my case, would the router not be corrupted. Where the server for router is present in a pc
Think, that those are alll unix commands
but i am having windows 7 machine.
Now, i am getting the results, by using kitty fork of putty, by just entering the user name password and remote or auto command in the box and then execute it with asimple bat file.
From numerous souces, i was told to shift to public key and private key.
i generate ok, then can i store them in my computer in a folder separately to access ,
, what i attempt is to monitor the router download and upload stream and to give command to reboot the router, in case of my ext ip is given as a ip belong to a group dynamic ip. Whenever a group ip is allotted , i find less speed in download .
So to monitor my router statistics, even when i am not browsing and downloading and uploading, i thought of using the ssh session.
Does the commands in point number 6 work for windows?
If suppose, i access the server, my router and share the public key, would it not corrupt the router
If i have the clarification, i will be thankful to you


#5

It is possible that your router can not be configured to use public/private key. Many routers can’t because to fit in the tiny storage/memory space of the appliance they stripped down the OS removing many normal *nix features. I’d ask the router manufacturer or users on their support forum for more specific answers.


#6

Hi, Paul, i again thank you for informing about the configuration.
Can i store the public key in my computer, and private key in another folder on the next drive to achieve it.
please, i will not use nix, in my terminal screen
So, if point 6 is slightly modified , thus storing public and private key, can i be secured in talk with the router to know the router status .
This command available in terminal give me useful information on all aspects of the speed, version, system time, dwnload speed uplload speed etc etc, including ext.ip
if i cnfigure a strong psword for router, will it be enough.
i checked with gibson sheilds up and got green tiks


#7

AFAIK, no, the key must reside on the server.


#8

So, i could not use Puttyfor my task/
Now, about Kitty, it is a fork form of putty, which allows access , by configuring auto command and some changes in the connection, data format of putty, but giving access to the router.
Paul, then what is about accessing remote coms using ssh.
if suppose, i want to access some com or website, i could as well search for it in google to access securely. is it not
Am i missing something here.
Please also tell me , what is the risk involved in accessing the router statistics thro this means.
There are some widgets in debian arts which gives download and upload speed, but it works only when you download something.
Paul one more query, If i use selenium automation thro ide, there is a risk of third party server, that i have to acess, is it not.
I would like to hear more from you.
Thanks for sharing what you know