Operating System - HP-UX
1832978 Members
2634 Online
110048 Solutions
New Discussion

Connect to HP server from Windows PC using openSSH

 
Yong Wai Choon
Advisor

Connect to HP server from Windows PC using openSSH

Hi, I have installed T1471AA.depot and openSSH into my HP server and PC respectively. I have also done the followings:
-Generate RSA key pairs in PC using command : ssh-keyegn -t rsa
-Set 'PubkeyAuthentication' to 'yes' in /opt/ssh/etc/sshd_config of HP server
-copy public key from PC into /home/user/.ssh directory as authorized_keys

My question is : what is the next step for me to connect from my PC into the HP server using ssh command?
Thanks.
16 REPLIES 16
SANTOSH S. MHASKAR
Trusted Contributor

Re: Connect to HP server from Windows PC using openSSH

Hi,

For connecting from ur PC to server using ssh
(I assume u r using Windows OS on ur PC) u
reauire ssh client (eg. putty, Cygwin etc.)
simpley select ssh connect option and provide
IP address of server etc. to ssh client. At first
time it will ask to accept key from server.
Thats all.

U can download putty from link below,

http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

for Cygwin check

http://www.cygwin.com/

-Santosh
SANTOSH S. MHASKAR
Trusted Contributor

Re: Connect to HP server from Windows PC using openSSH

Hi

with ssh command u can connect as

C:> ssh @

or

C:> ssh -l

-Santosh
Yong Wai Choon
Advisor

Re: Connect to HP server from Windows PC using openSSH

Hi, if I use ssh user@IP, the server will prompt for password but I want to use the 'Public-key' authentication method which is suppose to be more secure. That's why I have generated the RSA key, but I do not know how to proceed.
SANTOSH S. MHASKAR
Trusted Contributor

Re: Connect to HP server from Windows PC using openSSH

Hi,

To login without prompting for passowrd do this:

U have generated ssh keys for client by using
ssh-keygen. U then have 2 keys generated in 2
files,

public key in file id_rsa.pub
privet key in file id_rsa

add/append contents of clientside id_rsa.pub into server's
/home/user/.ssh/authorized_keys file.

Thats all

now u can connect without providing password.


-Santosh
Adisuria Wangsadinata_1
Honored Contributor

Re: Connect to HP server from Windows PC using openSSH

Hi Yong,

Good day to you !
You need to run the steps on both side, meaning on your HP Server & your PC.

The steps just like below :
1. generate public/private rsa key pair
2. run ssh-keygen >>> this will create id_rsa.pub
3. apply steps #1 & #2 on other system (ex. if you apply steps #1 & #2 on HP server, now you need to apply the steps #1 & 2 on your PC)
4. copy over public key to other system
5. on other system copy the public key to authorized_keys
6. do steps #4 & #5 on other system
7. test, by using ssh username@system

The other way around, just using putty. It's still free 8-)

Hope this information can help.

Cheers,
AW
now working, next not working ... that's unix
Yong Wai Choon
Advisor

Re: Connect to HP server from Windows PC using openSSH

Hi,I have done all the steps as mentioned, but server still prompt me for password.
SANTOSH S. MHASKAR
Trusted Contributor

Re: Connect to HP server from Windows PC using openSSH

Hi,

Try defalut configuration in sshd_config file,
it works. Otherwise check if u r copying the
public key correctly, a error in copying will
result in promping for password.


Yong Wai Choon
Advisor

Re: Connect to HP server from Windows PC using openSSH

Hi, please find following message when I used ssh with -v option:
C:\Program Files\OpenSSH\bin>
C:\Program Files\OpenSSH\bin>ssh -v user123@192.x.xxx.x
OpenSSH_3.8.1p1, OpenSSL 0.9.7d 17 Mar 2004
debug1: Connecting to 192.x.xxx.x [192.x.xxx.x] port 22.
debug1: Connection established.
debug1: identity file /home/user name in PC/.ssh/identity type -1
debug1: identity file /home/user name in PC/.ssh/id_rsa type 1
debug1: identity file /home/user name in PC/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.4p1-hpn12
v11
debug1: match: OpenSSH_4.4p1-hpn12v11 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_3.8.1p1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host '192.x.xxx.x' is known and matches the RSA host key.
debug1: Found key in /home/user name in PC/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interacti
ve
debug1: Next authentication method: publickey
debug1: Trying private key: /home/user name in PC/.ssh/identity
debug1: Offering public key: /home/user name in PC/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password,keyboard-interacti
ve
debug1: Trying private key: /home/user name in PC/.ssh/id_dsa
debug1: Next authentication method: keyboard-interactive
Password:
SANTOSH S. MHASKAR
Trusted Contributor

Re: Connect to HP server from Windows PC using openSSH

Hi,


if u look the following part of debug message


debug1: Authentications that can continue: publickey,password,keyboard-interacti
ve

---See the order of Auth. method


debug1: Next authentication method: publickey
debug1: Trying private key: /home/user name in PC/.ssh/identity
debug1: Offering public key: /home/user name in PC/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password,keyboard-interacti
ve
debug1: Trying private key: /home/user name in PC/.ssh/id_dsa

-- The Auth. fails here hence goes for next method
debug1: Next authentication method: keyboard-interactive
Password:


It seems public key PC is not matching with
key in servers authorized_keys. Check this
and try again.


At my machine I got following


[san@sde4 ~]$ ssh -v user@host
OpenSSH_4.2p1, OpenSSL 0.9.7f 22 Mar 2005
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to host [10.x.x.x] port 22.
debug1: Connection established.
debug1: identity file /home/san/.ssh/identity type -1
debug1: identity file /home/san/.ssh/id_rsa type 1
debug1: identity file /home/san/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.2p1-hpn
debug1: match: OpenSSH_4.2p1-hpn pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.2
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'host' is known and matches the RSA host key.
debug1: Found key in /home/san/.ssh/known_hosts:6
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Trying private key: /home/san/.ssh/identity
debug1: Offering public key: /home/san/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.



Christian Tremblay
Trusted Contributor

Re: Connect to HP server from Windows PC using openSSH

If you generate the key with Putty and move it to authorized_keys on the HP server, it will not work unless you modify the authorized_keys file:

1: The key has to be on ONE line with no cr/lf in it: use vi to edit

2: you have to insert the string "ssh-rsa" at the beginning like:

ssh-rsa AAAAB3NzaC1yc2EAAA... rest of key

Yong Wai Choon
Advisor

Re: Connect to HP server from Windows PC using openSSH

Hi, I have done every steps as instructed, but, still getting the same result. How do I verify that the public keys are correctly copied and in the right place?
Univer_1
Valued Contributor

Re: Connect to HP server from Windows PC using openSSH

hi

can you attach the content of your "authorized_keys" file which is located at your home directory of the ssh server?

You may need to ensure that your home directory, your .ssh directory, and any other files involved (such as authorized_keys, authorized_keys2 or authorization) are not group-writable or world-writable. You can typically do this by using a command such as

chmod go-w $HOME $HOME/.ssh $HOME/.ssh/authorized_keys
Yong Wai Choon
Advisor

Re: Connect to HP server from Windows PC using openSSH

Hi univer,
You meant the id_rsa.pub that I generated in my PC and subsequently copied to HP server as authorized_keys?
Steven Schweda
Honored Contributor

Re: Connect to HP server from Windows PC using openSSH

If you have any doubts about the key file
formats, use "ssh-keygen" on the HP-UX system
to make some key files, and then compare
those to what you've copied from the Windows
system. (Watch for non-obvious differences
like one line versus multiple lines.)
Yong Wai Choon
Advisor

Re: Connect to HP server from Windows PC using openSSH

Hurray! is working now!
Actually I only have to generate the key from my PC and copy into server as authorized_keys,that all!
Previously failed because I did something unnecessarily: i.e. generate and copy public key from server to PC!
Thank you guys for your help anyway.
Yong Wai Choon
Advisor

Re: Connect to HP server from Windows PC using openSSH

TQ