LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-18-2008, 11:40 AM   #1
nano2
Member
 
Registered: May 2007
Posts: 100

Rep: Reputation: 15
using TCP to do ssh connections within an app


Hi ,

I have the following scenario I am using telnet <localhost> port number
and this works fine over TCP sockets within the my application.

I want to be able to do similar with ssh
ssh <localhost> -p portnumber

I can get connected but it appears it's not listening or receiving requests

do I need anything to enable ssh I did a snoop on it and it looks like ther is traffic been ack.

Anyone have any ideas what i need to get the ssh to WORK ?


Thanks
 
Old 09-18-2008, 01:43 PM   #2
immortaltechnique
Member
 
Registered: Oct 2006
Location: Kenya
Distribution: Ubuntu, RHEL, OpenBSD
Posts: 287

Rep: Reputation: 32
Quote:
I can get connected but it appears it's not listening or receiving requests
Does this mean you can or cannot connect? Do you want to see the actual traffic? I might have missed something.
 
Old 09-18-2008, 03:54 PM   #3
nano2
Member
 
Registered: May 2007
Posts: 100

Original Poster
Rep: Reputation: 15
it appears to be connected when i run snoop on the port number i can see some activity but the problem is that when i write to the socket it just hangs till i do ctrl c and then disconnects ...

Do you know do i have to set anything different than the telnet connection ??????????????????????????????????????

the telnet call works fine.
 
Old 09-18-2008, 08:33 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,358

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Can you login manually via ssh and run a cmd eg ls on the remote box?
If not, add 1, 2 or 3 -v options to the cmd to enable debugging.
 
Old 09-18-2008, 09:39 PM   #5
immortaltechnique
Member
 
Registered: Oct 2006
Location: Kenya
Distribution: Ubuntu, RHEL, OpenBSD
Posts: 287

Rep: Reputation: 32
Perhaps your ssh.config needs abit of tweaking but may be you might want to run what chrism01 suggested. Paste your results here.
 
Old 09-19-2008, 03:17 AM   #6
nano2
Member
 
Registered: May 2007
Posts: 100

Original Poster
Rep: Reputation: 15
I don't have a config file in .ssh home directory?

What do i need to in here .
all I have is my private key in the .ssh directory

Thanks

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]
 
Old 09-19-2008, 05:20 AM   #7
nano2
Member
 
Registered: May 2007
Posts: 100

Original Poster
Rep: Reputation: 15
some more findings from my application :


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

with the ssh

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 hostname [10.0.8.10] 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 tahts 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 nano2; 09-22-2008 at 03:45 PM.
 
  


Reply



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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
List ongoing TCP connections krizzz Solaris / OpenSolaris 7 06-30-2007 01:50 AM
Kill TCP connections ballistic509 Debian 2 03-14-2007 05:33 PM
how many TCP connections at a time? hegdeshashi Linux - Networking 5 01-05-2006 11:19 PM
Need a way to limit TCP connections ewerta Linux - Networking 1 07-25-2005 03:54 PM
half-open tcp connections r_m_carlsson Linux - Networking 1 02-03-2004 05:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration