Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm having trouble executing long commands with ssh. The following works fine:

echo 'cd /home/www; echo aaaaaaaaaaaaaaaaaaaaasssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssaaaaaaaaaaaaaaaaaaaasssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaassssssssssssssssssssddddddddddddddddffffffffffffffffffffffffggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggghhhhhhhh' \
    | ssh -p '32' www@hostname /bin/bash

If I add another char to the command, ssh hangs indefinitely. If I first log in and then enter my command interactively, there is no length limit; unfortunately, I need to run the (generated) command from a script, so that doesn't solve the problem.

Versions for both client and server: OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5.

What can be the problem?

share|improve this question
    
can you scp a large file to the same server without hangs? –  Mike Pennington Jul 17 '12 at 8:04
    
Looks like a network issue to me. –  Andrew Smith Jul 17 '12 at 8:06

1 Answer 1

up vote 6 down vote accepted

It seems to be not SSH problem, but the problem of your network, or rather it MTU settings.Such problem described in detail here.

share|improve this answer
    
Yup, lowering MTU on the client helped. Thanks! –  Johnny Woo Jul 17 '12 at 9:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.