Openssh : keys generated on ssh server or ssh client

Posted on 2011-03-08
Medium Priority
Last Modified: 2012-06-22

Q1 : basic question:
I have a Windows 2003 running Openssh server & a Linux box (ssh client).
The Linux box is the one that initiate sftp/ssh/scp connection to the Windows
box.  I would like to use key authentication, so are the private+public keys
generated (ie ssh-key-gen) on Windows 2003 or on the Linux box?

If the keys are generated on the Windows 2003 Openssh (Ver 3.8p1-1), can
 someone provide the steps to generate the keys & how should the key be
added/processed on the Linux box to enable the Linux box to ssh into the
Windows 2003  box using the keys (ie no password needed)

If the keys are generated on the Linux box (RHES 4.5), what's the command
to generate the keys & how should the keys be added/installed on the
Win 2003 box so that the Linux (ssh client) can ssh into the Windows box
without password (ie keys authentication
Question by:sunhux
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2

Author Comment

ID: 35069243

I got a feeling that the ssh keys should be generated on the ssh client
(ie the Linux box in my case) & the public key is then sent to the Win2003
Openssh server.

suppose I have a login id on the Openssh Win2003 server, is
the following steps correct to install the public key into the Openssh
Win2003 server?

$ mkdir -p ~/.ssh If it doesn’t already exist
$ chmod 700 ~/.ssh
$ cd ~/.ssh
$ ssh-keygen -t rsa
$ cat ~/.ssh/id_rsa.pub | ssh remote_loginid@sshserver_hostname ‘mkdir .ssh; chmod 700 .ssh; cat>>.ssh/authorized_keys’
LVL 27

Accepted Solution

Nopius earned 668 total points
ID: 35077850
> I got a feeling that the ssh keys should be generated on the ssh client
(ie the Linux box in my case) & the public key is then sent to the Win2003
Openssh server.


> is the following steps correct to install the public key into the Openssh
Win2003 server?

No. Read here http://www.cs.bham.ac.uk/~smp/projects/ssh-windows/
Scroll down to 'To enable public key authentication for users other than Administrator:'.

LVL 27

Expert Comment

ID: 35077860
Public key you can get from Linux after generation.
Give Your Engineering Team a Productivity Boost

Learn why container technology is so powerful and how it can provide your team with productivity gains and other benefits.

LVL 40

Assisted Solution

noci earned 1332 total points
ID: 35081407
Technically it doesn't matter where you generate the key (best is on a machine with a good random numbers generator), it can even be a 3rd system not used in the communication between client and server.

Then you keep the private key for your self and have the public key installed on every system where you need it.

You must be able to totally trust or control the system where you generate a key. (if you need it you can have multiple private/public key pairs for different purposes.., the key to be used can be specified by default it is id_dsa/id_rsa ...)
If you cannot trust those systems then don't generate a key there. Also keep in mind that the file storage that is temporarily used isn't wiped after use if you just remove the files.

Author Comment

ID: 35083297

Thanks chaps.

2 more clarifications:

a) if my Linux ssh client has multiple (8 to be precise) Unix accounts that need to ssh into
    the  Win2003 Openssh server (all 8 use a common login id on Win2003 to ssh/scp), do
    I need to generate 8 pairs of keys using each of the 8 Unix accounts or I can just use
    root on my Linux box to generate 1 pair & then distribute the keys to the $HOME/.ssh
    directories of each of the 8 Unix accounts & to $HOME/.ssh of the Win2003 id ?

b)when doing ssh-keygen on Linux, should I use dsa or rsa?  Rather which is more
   secure of the two?

Author Comment

ID: 35083307

For question (b) above, which of the two ( rsa & dsa ) are supported by OpenSsh
  in Windows 2003?
LVL 40

Assisted Solution

noci earned 1332 total points
ID: 35083552
a) yes, the certificates are assumed to be personal.
You can off-course distribute the same private key to all people, but if you need to revoke ONE, you need to issue all others a new key...
and you need to add all public keys to the ~/.ssh/authorized_keys or ~/.ssh/authorized_keys2  files.

b) dsa is a more recent version and may be assumed more future proof.
At lease ensure that everything is SSH V2... (dont mix ssh1 rsa keys  with ssh2...  dsa slightly preferred, rsa1 definitely forbidden.).
I am not sure what you mean by openssh in windows (most probably the cygwin one, and yes they should be supported).

Also configure the sshv1 to be forbidden.

Author Closing Comment

ID: 35206039

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
When it comes to security, there are always trade-offs between security and convenience/ease of administration. This article examines some of the main pros and cons of using key authentication vs password authentication for hosting an SFTP server.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses
Course of the Month10 days, 18 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question