GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 19-Sep-2008, 03:28
nano2 nano2 is offline
New Member
 
Join Date: Sep 2008
Posts: 2
nano2 is on a distinguished road

Using TCP sockets to connect via SSH within a C++ application


Hi ,

I have the following scenario where by I can connect using telnet
telnet localhost portnumber

However I want to now have the capability to connect via SSH

ssh localhost -p port number

My application is using the TCP socket connection and works fine for the telnet.

I can ssh sucessfully into the localhost w/o supplying a password and this is my o/p.

Do I need to put something in my code so that it can do the same ..

Please advise .
Thanks

Code:
output from ssh <hostname> -v Sun_SSH_1.1, SSH protocols 1.5/2.0, OpenSSL 0x0090704f debug1: Reading configuration data /etc/ssh/ssh_config debug1: Rhosts Authentication disabled, originating port will not be trusted. debug1: ssh_connect: needpriv 0 debug1: Connecting to billc [10.0.3.1] port 22. debug1: Connection established. debug1: identity file /home/t/.ssh/identity type -1 debug1: identity file /home/t/.ssh/id_rsa type 1 debug1: identity file /home/t/.ssh/id_dsa type 2 debug1: Remote protocol version 2.0, remote software version Sun_SSH_1.1 debug1: no match: Sun_SSH_1.1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-Sun_SSH_1.1 debug1: Failed to acquire GSS-API credentials for any mechanisms (No credentials were supplied, or the credentials were unavailable or inaccessible Unknown code 0 ) 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: Peer sent proposed langtags, ctos: fr,fr-BE,fr-FR,en-GB,en-IE,nl,nl-BE,nl-NL,i-default debug1: Peer sent proposed langtags, stoc: fr,fr-BE,fr-FR,en-GB,en-IE,nl,nl-BE,nl-NL,i-default debug1: We proposed langtags, ctos: i-default debug1: We proposed langtags, stoc: i-default debug1: Negotiated lang: i-default debug1: SSH2_MSG_KEX_DH_GEX_REQUEST sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: Remote: Negotiated main locale: C debug1: Remote: Negotiated messages locale: C debug1: dh_gen_key: priv key bits set: 128/256 debug1: bits set: 1592/3191 debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Host 'billc' is known and matches the RSA host key. debug1: Found key in /home/t/.ssh/known_hosts:2 debug1: bits set: 1566/3191 debug1: ssh_rsa_verify: signature correct debug1: newkeys: mode 1 debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: newkeys: mode 0 debug1: SSH2_MSG_NEWKEYS received debug1: done: ssh_kex2. debug1: send SSH2_MSG_SERVICE_REQUEST debug1: got SSH2_MSG_SERVICE_ACCEPT debug1: Authentications that can continue: gssapi-keyex,gssapi-with-mic,publickey,password,keyboard-interactive debug1: Next authentication method: gssapi-keyex debug1: Next authentication method: gssapi-with-mic debug1: Failed to acquire GSS-API credentials for any mechanisms (No credentials were supplied, or the credentials were unavailable or inaccessible Unknown code 0 ) debug1: Next authentication method: publickey debug1: Trying private key: /home/t/.ssh/identity debug1: Trying public key: /home/t/.ssh/id_rsa debug1: Server accepts key: pkalg ssh-rsa blen 149 lastkey 6dd88 hint 1 debug1: read PEM private key done: type RSA debug1: Authentication succeeded (publickey) debug1: channel 0: new [client-session]
Last edited by admin : 19-Sep-2008 at 23:02. Reason: Please insert your example codes between [CODE] and [/CODE] tags
  #2  
Old 19-Sep-2008, 05:18
nano2 nano2 is offline
New Member
 
Join Date: Sep 2008
Posts: 2
nano2 is on a distinguished road

Re: Using TCP sockets to connect via ssh within a c++ application


Something else I forgot to add

when I
telnet hostname portnumber
Trying...
Connected to hostname.x.lan.
Escape character is '^]'.
prompt>

with the ssh
Code:
ssh hostname -p 39505 -v OpenSSH_3.8, OpenSSL 0.9.7d 17 Mar 2004 HP-UX_Secure_Shell-A.03.81.003, HP_UX Secure Shell version debug1: Reading configuration data /opt/ssh/etc/ssh_config debug1: Connecting to billc [10.0.3.1] port 39505. debug1: Connection established. debug1: identity file /home/t/.ssh/id_rsa type 1 debug1: identity file /home/t/.ssh/id_dsa type 2

It appears the ssh session thats established isn't sending or receiving requests as it hangs not responding .

Whereas I would expect the same behaviour from the telnet session returning back to prompt> as requested in the code .

Any ideas why I'm not getting this with ssh?
Last edited by admin : 19-Sep-2008 at 23:04. Reason: Please insert your example codes between [CODE] and [/CODE] tags
 
 

Recent GIDBlogI?m Home by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
BarracudaDrive application server for Linksys NSLU2 BDG Computer Software Forum - Linux 0 24-Mar-2008 15:24
Simple Window Application Using MFC Peter_APIIT MS Visual C++ / MFC Forum 6 28-Sep-2007 03:38
Application which packages another application with other files. SharathKA MS Visual C++ / MFC Forum 0 09-Dec-2006 00:32
Multi-client application using sockets shereen Java Forum 0 03-Mar-2006 10:25
Help! Some basal questions about MFC xutingnjupt MS Visual C++ / MFC Forum 1 05-Dec-2004 04:38

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 05:15.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.