"ssh example.com" freezes, but "ssh example.com bash -i" is not

every day I come across a very strange phenomenon.

From my internet connection at the university, sshing on my machine ("ssh example.com") works without problems.

From my home ad "ssh example.com" my console is stuck in this post:

debug1: Server accepts key: pkalg ssh-rsa blen 533 debug1: Enabling compression at level 6. debug1: Authentication succeeded (publickey). debug1: channel 0: new [client-session] debug1: Requesting no-more-sessions@openssh.com debug1: Entering interactive session. 

Sometimes this may allow me to enter, but in most cases not. The funny thing is that if I ran "ssh example.com bash -i", I immediately logged in.

+6
login ssh netcat
source share
5 answers

Finally, I found the source of the problem. It is associated with TCP packets such as SSH (ToS).

When you request a regular ssh file, ssh sets the TCP (ToS) service type to "interactive". My router at my location blocks these types of packets!

Using netcat, tunneled TCP packets do not receive any service directives. Thus, if you tunnel all your ssh traffic through netcat, you will reset ToS of TCP packets by default.

In .ssh / config you should install:

 Host *.example.com ProxyCommand nc %h %p 

So, every time you try to use ssh for example.com, netcat is called and the packets are tunneled.

+11
source share

Starting with OpenSSH 5.7 , you can simply add this to your ssh configuration file (either ~ / .ssh / config or / etc / ssh / ssh _config):

  Host *
   IPQoS 0x00

This is a more direct way to get around the problem identified by Asterios.

+8
source share

I had the same problem. Try logging in with another ssh client for more information. Whereas the linux command line client did not return with any useful message, Putty returned with "the server refused to allocate pty". I installed it using mkdir / dev / pts and mount -a. How it happened, first of all, I'm less sure.

BTW, bash -l should act as a login shell, so you should be able to prove the correctness or incorrectness of Peter Westlake's suggestion in your case.

+1
source share

The difference between the two cases is that "bash -i" does not give you an login shell, but ssh just works. You can "man bash" for more information on what the "login shell" is, but most importantly, it runs / etc / profile and your .bash_profile. Look at these files for anything that might cause problems.

0
source share

There may be no ptys on the server.

0
source share

All Articles