ssh command on remote linux system hanging

 
Thread Tools Search this Thread
Operating Systems Linux SuSE ssh command on remote linux system hanging
# 1  
Old 09-21-2007
ssh command on remote linux system hanging

Hi,
Our systems:
system1: amd 64 running suse linux 9 enterprize
system2: amd 64 running esx vmware 3 with suse linux 9 enterprize.


The problem is:
when we ssh into system2 and execute the command:
ls -al
the session hangs. Infact session hangs when we execute any command returning multiple rows (by pressing the ctrl y we are able to come out of the hang, but no result).

Similar problem occur when running:
ssh system2 "ls -al /opt/oracle"

,but if we run the following:

ssh system2 "ls /opt/oracle" the output is ok it's also ok if you are on
system2 and execute: ls



All suggestions will be most appreciated.

Thanks.
# 2  
Old 09-24-2007
run ssh command with -vv flag to see more verbose sessions, and also try -t and -T options, they are for pseudo-tty allocation.
# 3  
Old 09-25-2007
Hi,
Thanks for the reply running the command:
~> ssh -vv mirror "ls -al"
OpenSSH_4.1p1, OpenSSL 0.9.7d 17 Mar 2004
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to mirror [10.99.47.7] port 22.
debug1: Connection established.
debug1: identity file /opt/oracle/.ssh/identity type -1
debug1: identity file /opt/oracle/.ssh/id_rsa type -1
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug2: key_type_from_name: unknown key type '-----END'
debug1: identity file /opt/oracle/.ssh/id_dsa type 2
debug1: Remote protocol version 1.99, remote software version OpenSSH_4.1
debug1: match: OpenSSH_4.1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.1
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_init: found hmac-md5
debug1: kex: server->client aes128-cbc hmac-md5 none
debug2: mac_init: found hmac-md5
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
debug2: dh_gen_key: priv key bits set: 126/256
debug2: bits set: 494/1024
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'mirror' is known and matches the RSA host key.
debug1: Found key in /opt/oracle/.ssh/known_hosts:10
debug2: bits set: 531/1024
debug1: ssh_rsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /opt/oracle/.ssh/identity ((nil))
debug2: key: /opt/oracle/.ssh/id_rsa ((nil))
debug2: key: /opt/oracle/.ssh/id_dsa (0x55f5e0)
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Trying private key: /opt/oracle/.ssh/identity
debug1: Trying private key: /opt/oracle/.ssh/id_rsa
debug1: Offering public key: /opt/oracle/.ssh/id_dsa
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-dss blen 433
debug2: input_userauth_pk_ok: fp 5d:34:c5:9e:6a:be:e4:65:01:4e:81:36:8a:a0:fa:9c
debug1: read PEM private key done: type DSA
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug2: channel 0: send open
debug1: Entering interactive session.
debug2: callback start
debug2: client_session2_setup: id 0
debug1: Sending environment.
debug1: Sending env LANG = en_GB.UTF-8
debug2: channel 0: request env confirm 0
debug1: Sending command: ls -al
debug2: channel 0: request exec confirm 0
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 131072

At this stage the session is hung.

if I run with -t then then session hangs.


Regards,
# 4  
Old 09-26-2007
That's strange......
I ran the same command, and here's what you miss after the hang :
Quote:
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug2: channel 0: rcvd close
debug2: channel 0: close_read
debug2: channel 0: input open -> closed
debug1: channel 0: forcing write
# The output of the "ls -la" follows...
debug2: channel 0: obuf empty
debug2: channel 0: close_write
debug2: channel 0: output drain -> closed
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 0.7 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0
debug1: Exit status 0
I have the same openssh versions as you, but I'm not sure why you cannot complete the command, I can't find anything suspicious in your debug log, besides I'm using password as authentication method, and you are using ssh keys. You can try different machine, thus determine whether the problem is in the server, or the client machine.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Copying a text file from my Ubuntu Windows Sub System to a remote instance through SSH

*Following questions involves use of YAML, BASH, SSH and Software called Ansible* I am trying to learn how to use a Linux environment (in my case a Ubuntu Windows Sub System) to copy a text file from my files to a remote instance (in this case Amazon Web Services) by connecting via SSH. I... (8 Replies)
Discussion started by: Suhaba
8 Replies

2. Shell Programming and Scripting

Execute ssh command with additional terminal command to any remote user not working script

Hello i am having an issue with bash script and this is the code now=$(cat hosts1.txt | awk '{print $2;}') while read n ;do ssh root@$now 'useradd test1; echo -e "test1\ntest1" | passwd test1 && echo "test1 ALL=(ALL:ALL) ALL" >> /etc/sudoers' When i execute only part with cat, it... (8 Replies)
Discussion started by: tomislav91
8 Replies

3. Shell Programming and Scripting

Running Commands on a Remote Linux Server over SSH

Hello, I'm trying to create a ksh script to ssh to a remote server, enter the password and a couple commands. For security reasons I have changed the login, password and ip in my example. #!/bin/ksh ssh -t -t username@12.5.5.3 << EOF password cd bin pwd EOF When I run it. It... (5 Replies)
Discussion started by: seekryts15
5 Replies

4. Shell Programming and Scripting

Remote command in variable using ssh

Hi, I've an issue in a shell script: I'm opening an ssh connection to a remote server, then I want to store the result of a ls command in a variable, but it doesn't work: the ls is done on the local machine. ssh user@server << EOF ls # works as expected (ls is done remotely) test=`ls` # the... (1 Reply)
Discussion started by: seloum57
1 Replies

5. Shell Programming and Scripting

ssh sending local variable to remote system

I am running a useradd script, which works locally but I want to take some of that local information and send it to a remote system, ssh keys are set up between the two systems. I am attaching the script, look at the section titled "Sending information to FTP2" Removed attachment, added... (0 Replies)
Discussion started by: slufoot80
0 Replies

6. Shell Programming and Scripting

ssh to remote command prompt

Hi all, Scenario - trying to run a batch job on a second machine. DIR=directory user=user server=server Here is what i have- ssh user@server 'sleep2; cd $DIR; <jobname>' I have got access to the correct directory, i checked with a pwd command previous. Problem is the job i... (1 Reply)
Discussion started by: Hopper_no1
1 Replies

7. Solaris

how to login with ssh to remote system with out applying the remote root/usr password

how to login with ssh to remote system with out applying the remote root/user password with rlogin we can ujse .rhosts file but with ssh howits possible plz guide (2 Replies)
Discussion started by: tv.praveenkumar
2 Replies

8. Shell Programming and Scripting

Regarding ssh into remote system

How can i ssh into a remote system using ssh command in a shell script with password? I havent used password less authentication for the remote system. Thanks and Regards, Rupaa (4 Replies)
Discussion started by: Rupaa
4 Replies

9. Shell Programming and Scripting

Executing a script on a remote system via SSH

Hello all, I have a relatively simple script I wrote to generate a count of errors broken down. What I would like to do is execute this script from another server so that I don't actually have to log in to the server to run the check. The script on what we'll call "Server A" is: ... (2 Replies)
Discussion started by: DeCoTwc
2 Replies

10. Shell Programming and Scripting

Running ssh on a remote system?

I need to install ypbind and yp-tools on over two-hundred remote client machines based on their redhat version. I have a centralized server on which I created an ssh public key. I then transfered the ssh public key to the authorized_keys file on all the remote hosts; therefore, I can login without... (1 Reply)
Discussion started by: cstovall
1 Replies
Login or Register to Ask a Question