0

I've set up a connection with autossh that creates some tunnels at system startup, but if I try to connect, after successful login (with RSA key) connection fall down, here a trace:

debug1: Authentication succeeded (publickey).

debug1: Remote connections from LOCALHOST:5006 forwarded to local address localhost:22
debug1: Remote connections from LOCALHOST:6006 forwarded to local address localhost:80
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.

debug1: remote forward success for: listen 5006, connect localhost:22
debug1: remote forward success for: listen 6006, connect localhost:80

debug1: All remote forwarding requests processed
debug1: Sending environment.
debug1: Sending env LANG = it_IT.UTF-8
debug1: Sending env LC_CTYPE = en_US.UTF-8
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2400, received 2312 bytes, in 1.3 seconds
Bytes per second: sent 1904.2, received 1834.4
debug1: Exit status 1

What can be the problem?

All this stuff is managed by a script already running on another machine (creating reverse tunnels on the same machine but with different ports)

2 Answers 2

1

Since the client is sending an environment, but no command, it means the client is trying to start a shell as that user. But that shell exits immediately causing the ssh connection to terminate.

Try to ssh in as that user from the command line without going through autossh. It may provide some additional hints, and is interesting to know, if you can get to a shell that way.

The user may have been configured with the wrong shell, or access to the shell may have been overridden in ~/.ssh/authorized_keys by using command="…"

1
  • ok, it was my fault, I wrongly used -n instead of -N so it was actually trying create a shell session (while shell of user was /bin/false). Since I only wanted to create a tunnel, -N was the right flag
    – kappa
    May 29, 2014 at 13:51
0

Try add the KeepAlive options in /etc/ssh/ssh_config file (or ~/.ssh/config if you wish apply to single user)

For example:

     ClientAliveInterval 300
     ClientAliveCountMax 2

If a client, and

Host *
     ServerAliveInterval 300
     ServerAliveCountMax 2

if a server

1
  • The ssh command exits after just 1.3 seconds. It couldn't have been idle for 300 seconds already.
    – kasperd
    May 29, 2014 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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