# ssh remote command execution stuck



## mitrucs (Apr 10, 2012)

Hi all,

After a while of intensive googling and configuration tuning, I finally decided to submit my case here.

I'm trying to execute commands remotely from my linux box (OpenSSH_5.3p1) to my freebsd FreeBSD box (OpenSSH_5.8p2_hpn13v11). The strange thing is that it works for some commands and not for others and moreover it depends on args. Basically, I just wanted to execute *ls*:

```
linux-box:~$ ssh user@freebsd-box ls /some/dir
```

Then I figured out that, according to the amount of files in the targeted directory, the command was stuck or not.

I ended with this little script to measure the actual amount of maximum data that a command can output without being stuck:

```
linux-box:~$ cat test 
DIR=/home/data/test
rm $DIR/*
COUNT=0
while [  1 ]; do
	ls -rt $DIR
	touch $DIR/$COUNT
	let COUNT=COUNT+1
	echo $COUNT
done

linux-box:~$ ssh user@freebsd-box 'bash -s' < test
1
2
3
.
.
.
160
161
162
163
164
165
166
167
168
169
171
^C
```
After 171 or so, I have to stop the script because it is stuck.

Curiously, the same script applied from my mac box (OpenSSH_5.2p1) works continuously.

Any idea of what's going on?


----------



## SirDice (Apr 11, 2012)

What happens if you run the script locally?

All ssh(1) does is connect to the remote machine and execute whatever you told it.


----------



## mitrucs (Apr 11, 2012)

Locally, it works fine on any box.

It really seems like there is a maximum output for each command launched remotely. It is not limited to ls. Commands with small output works while others just don't.


----------



## SirDice (Apr 11, 2012)

Have you tried the other way around? From the FreeBSD box to the Linux machine. Does that have the same result?


----------



## DutchDaemon (Apr 11, 2012)

The only circumstances where I see that type of behavior is when there's an MTU problem.


----------



## SirDice (Apr 11, 2012)

Yeah, I'm leaning towards a network issue too. Either that or some incompatibility between OpenSSH 5.8 and 5.3.


----------



## mitrucs (Apr 12, 2012)

From the FreeBSD box to the Linux machine, there is no problem running the script.

During my research, I found some similar problems but none were solved. As I already lost a lot of time on this, I final*l*y opted to develop my scripts on another box, running MacOS.

I can reproduce the problem from another linux box running OpenSSH_5.5p1. Maybe is it also linked to the fact that the FreeBSD box is accessed via IPv6 only? Bug? Or, as you suggest, some kind of network issue.

BTW, how can I tune the MTU?


----------

