Re: Remote command takes minutes



l0b0 wrote:
On Mar 20, 10:11 am, Nico Kadel-Garcia <nka...@xxxxxxxxx> wrote:
On 20 Mar, 08:51, l0b0 <victor.engm...@xxxxxxxxx> wrote:

I'm trying to run a remote command using SSH, but it's taking several
minutes to complete.

Example shell output (anonymized):
$ time ssh -p 12345 -v example.org "ls"
... [takes less than a second]
j...@xxxxxxxxxxx's password:
archivedebug1: Authentication succeeded (password).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending command: ls
[here it hangs for a loooong time]
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
[result of "ls" command]
[hangs here as well]
debug1: channel 0: free: client-session, nchannels 1
debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 452.9
seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0
debug1: Exit status 0

real 7m39.620s
user 0m0.012s
sys 0m0.004s

Those are actual times! I've tried logging in using
ssh -p 12345 example.org
and then running the command, and that takes seconds and milliseconds,
respectively, as expected.

Why is the remote command execution so slow?

So you've got it running on port 12345. Fine. Are there any other
differences?

/etc/ssh/sshd_config specifies "Protocol 2", but I think that's
default. Other than that and the port, I'm using the default
sshd_config.

And do you have any sets of clever oddnesses in
your .profile htat behave differently depending on whether you have a
tty?

Only this, which is default in Ubuntu:
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
fi

And does it make a difference if your ssh login happens *first*,
and hten you try the ssh remote command? I'm thinking about reverse
DNS for the SSH server, and randomness generation on both machines.

Also, what happens if you use "ssh -p 12345 example.org ls" on
example.org itself?

After running
$ ssh -p 12345 example.org
both of these are fast:
$ time ls
...
real 0m0.007s
user 0m0.004s
sys 0m0.000s

$ time ssh -p 2222 localhost "ls"
...
real 0m2.966s
user 0m0.012s
sys 0m0.004s

Now this is getting ridiculous - SSH-ing in and then running commands
works fine now, and is quick as anything. But now every remote command
times out.

$ tail -2 /var/log/auth.log
Apr 25 13:18:18 hostname sshd[27985]: Accepted publickey for username
from 128.xxx.yyy.zzz port 42487 ssh2
Apr 25 13:18:18 hostname sshd[27987]: pam_unix(ssh:session): session
opened for user username by (uid=0)

$ ssh -v
OpenSSH_4.6p1 Debian-5ubuntu0.2, OpenSSL 0.9.8e 23 Feb 2007

Any tips on how to debug this? Both machines are behind a firewall.

--
Victor Engmark
.



Relevant Pages

  • Trouble with ssh secure tunnel for VNC
    ... "work" using VNC through a ssh tunnel with port forwarding. ... on work and issuing the command 'vncviewer work:1' from home. ... debug1: Connections to local port 5902 forwarded to remote address work:5901 ... debug1: channel 2: new ...
    (comp.security.ssh)
  • Re: Remote command takes minutes
    ... debug1: Entering interactive session. ... debug1: Sending environment. ... and then running the command, and that takes seconds and milliseconds, ... and hten you try the ssh remote command? ...
    (comp.security.ssh)
  • RE: RE : RE : X11Forwarding problem on Solaris.
    ... The program is using the display environment variable. ... First i use ssh to connect from node2 to node4 and then I start the PROGRAM ... debug1: Connection established. ... Subject: RE: RE: X11Forwarding problem on Solaris. ...
    (SSH)
  • Solaris->Fedora6 unidirectional problem
    ... I have a strange unsolved unidirectional problem using ssh from Solaris to Fedora6: ... I have a couple FC6 behind the Solaris boxes ... debug2: fd 4 setting O_NONBLOCK ... debug1: fd 4 clearing O_NONBLOCK ...
    (SSH)
  • [SLE] Slow SSH login
    ... A> ssh B ... second delay no matter the authentication mechanism ... debug1: Authentication succeeded. ...
    (SuSE)