admin@glassfish.java.net

Re: setup-ssh failed for pure cygwin machines.

From: Yamini K B <Yamini.Kb_at_Sun.COM>
Date: Fri, 10 Dec 2010 16:32:39 +0530
Hi Elena,

I generally follow the instructions on this page and have not run into any issues so far:

http://wikis.sun.com/display/GlassFish/3.1SSH+-+Installing+Windows+Cygwin+sshd

I'm able to run setup-ssh also without any issues.  I have 2 windows machines with non-admin user and cygwin installed. Just to show you, I deleted the .ssh folder under windows user home as well as cygwin user home on both machines:

$ ./asadmin.bat setup-ssh --sshuser Yamini 10.12.152.46
SSH key not found for user Yamini
Would you like to generate a SSH key pair (without a key passphrase) for Yamini
to access [10.12.152.46]? [y/n]: y
Enter SSH password for Yamini@10.12.152.46>
Created directory C:\Documents and Settings\Yamini\.ssh
ssh-keygen successfully generated the identification C:\Documents and Settings\Y
amini\.ssh\id_rsa
Copied keyfile C:\Documents and Settings\Yamini\.ssh\id_rsa.pub to Yamini@10.12.
152.46
Successfully connected to Yamini@10.12.152.46 using keyfile C:\Documents and Set
tings\Yamini\.ssh\id_rsa
Command setup-ssh executed successfully.

Yamini@crux /home/yamini/gf/glassfish3/glassfish/bin
$ ssh Yamini@10.12.152.46 ls
The authenticity of host '10.12.152.46 (10.12.152.46)' can't be established.
RSA key fingerprint is 1b:41:35:ec:55:fc:3b:15:91:51:9f:24:e6:eb:9d:43.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.12.152.46' (RSA) to the list of known hosts.
Yamini@10.12.152.46's password:

Yamini@crux /home/yamini/gf/glassfish3/glassfish/bin
$ pwd
/home/yamini/gf/glassfish3/glassfish/bin

Yamini@crux /home/yamini/gf/glassfish3/glassfish/bin
$ ls ~/.ssh
known_hosts

Yamini@crux /home/yamini/gf/glassfish3/glassfish/bin
$ cp /cygdrive/c/Documents\ and\ Settings/Yamini/.ssh/id_rsa ~/.ssh

Yamini@crux /home/yamini/gf/glassfish3/glassfish/bin
$ ssh Yamini@10.12.152.46 ls
gf


setup-ssh will generate the key pair under windows user home since it is not aware of cygwin home. Hence, I manually copy the key to the cygwin home folder. You can also see that setup-ssh was able to verify the connection and also the the last command above succeeds with key auth. On remote host, I didn't do any manual step.

Regards,
-Yamini

Yamini@crux /home/yamini/gf/glassfish3/glassfish/bin

Hi Joe,

I've tried to run many times ssh-host-setup not under Administrator user, but under another user with administrator privileges. It doesn't work. First passwd command doesn't allow to setup a password. Second service creation always failed.  But it works fine under Administrator user, and then the created service is available for other users.  But anyway, if would C:\cygwin\home\<user_name> directory would be created, it would not help setup-ssh, because setup-ssh is looking for C:\home\<user_name> directory.

Thank you,
Elena


Joe Di Pol wrote:

Elena,

It is a prerequisite that the SSH account is configured for the
user before you run setup-ssh. So you must have ssh working
to the point where you can SSH into the system as the user you want
(using username/password) before running setup-ssh. When setting
up an account with the cygwin tool's the user's home directory
should be created.

Joe


Elena Asarina wrote:
Hi All,

I want to share my last experience with using  setup-ssh command on pure cygwin machines.  In general,  the command proved again that  it is useless.   I've  executed ssh-host-config under Administrator user, because only under Administrator can be executed passwd command and  service can be created.  Then I've logged in as another user (aroot) , checked that ssh service started and tried to configure ssh without password, using  setup-ssh.  It failed immediately telling that a directory  /home/aroot doesn't exist. I've created C:\home\aroot (on both machines),  then  was created C:\home\aroot\.ssh dir with correspondent files, but connection - failed.

Then I've executed ssh-keygen, that command  first  reported that /home/aroot doesn't exist. After that I understood that really has to be used C:\cygwin\home\aroot dir, so I've created aroot dir under C:\cygwin\home\, then ssh-keygen was executed successfully and I was able to configure ssh without password, using C:\cygwin\home\aroot\.ssh directories.

Bottom line, because ssh-host-config was executed under Administrator, then only Administrator subdirectory was created under C:\cygwin\home\, to be able to execute successfully  ssh-keygen I was need to create aroot  dir manually, then everything went smoothly.  But setup-ssh tried to configure everything under C:\home\aroot and it did not work.

I believe I had absolutely typical cygwin installation  and probable setup-ssh would work the same way for other cygwin users.

Thank you,
Elena