News for hackers. Stuff that matters.
Re:SSH Multiplexing & other OpenSSH Tricks by mst on Saturday August 21, 2010 @09:38PM (#1624022)
I do wish keepalive could be turned on/off more dynamically - most of the locations I connect from it's a disadvantage so I don't have it configured, and having to edit the config file when I'm in one where it's useful just annoys me.

I suppose I should just write a script that perl -pi -e 's/KeepAlive yes/KeepAlive no/' .ssh/config or similar, but it still seems ... annoying.

Re:SSH Multiplexing & other OpenSSH Tricks by slug on Sunday August 22, 2010 @12:59AM (#1624253)
You can create 'fake' hosts but with the same hostname:

  ~/.ssh/config
  Host serverWith
      HostName server.home.net
      OptionBLA yes

  Host serverWithout
      HostName server.home.net
      OptionBLA no

It also has autocomplete, so you can type ssh server<TAB>
Re:SSH Multiplexing & other OpenSSH Tricks by JoachimSchipper on Sunday August 22, 2010 @03:50AM (#1624370)
"It" being your shell. Some do.
Re:SSH Multiplexing & other OpenSSH Tricks by slug on Monday August 23, 2010 @12:28AM (#1625849)
You are right, but who is the masochist that uses one that doesn't have that functionality ? ;)
Re:SSH Multiplexing & other OpenSSH Tricks by joeshaw on Saturday August 21, 2010 @09:50PM (#1624042)
You might be able to provide it with the -o option:

ssh -o "KeepAlive no" example.com

Re:SSH Multiplexing & other OpenSSH Tricks by pafy on Saturday August 21, 2010 @11:31PM (#1624153)
What about in your config file:

  Host *.whatever.com
  ServerAliveInterval 900
  Host *.whatsup.com
  ServerAliveInterval 60
Re:SSH Multiplexing & other OpenSSH Tricks by mst on Sunday August 22, 2010 @01:48AM (#1624285)
It's about where I am, not about where they are. slug's comment looks like a great idea though.
Re:SSH Multiplexing & other OpenSSH Tricks by est on Sunday August 22, 2010 @12:48AM (#1624242)
> I do wish keepalive could be turned on/off more dynamically

PuTTY can do that. It's GUI though.

Re:SSH Multiplexing & other OpenSSH Tricks by njn on Sunday August 22, 2010 @03:49AM (#1624368)
I'm curious why you would want multiple connections to the same host in the first place. Why not use a terminal multiplexer?
Re:SSH Multiplexing & other OpenSSH Tricks by lars512 on Sunday August 22, 2010 @07:10AM (#1624500)
It removes the latency if you need to interact with the remote server, for example with remote repositories. I tried some experiments today with Bitbucket, and using connection multiplexing halved the time of most of my common mercurial operations (8s -> 4s).
Re:SSH Multiplexing & other OpenSSH Tricks by danohuiginn on Sunday August 22, 2010 @05:24AM (#1624427)
it's convenient if you want to pipe the output of a command on a remote machine into another command on a local machine

ssh server remotecommand | localcommand

Re:SSH Multiplexing & other OpenSSH Tricks by danohuiginn on Sunday August 22, 2010 @05:48AM (#1624451)
And some reasons why you might want to do that:

* set up a machine with all packages installed on some (debian/ubuntu) server: ssh server dpkg --get-selections| cut -f1 | xargs sudo apt-get install

* compare output of commands on two machines diff <(command) <(ssh server command)

* test/configure software on a local machine, plugging in its input from the roduction machine where it will be installed once ready

* avoid installing software on the server entirely; pull in the remote output and wrangle it locally (obv. not so good for high volumes)

* think a bug can be fixed by upgrading some software? try it on a test machine, pipe in the required input, and see

Re:SSH Multiplexing & other OpenSSH Tricks by ljlolel on Sunday August 22, 2010 @08:27AM (#1624541)
Is there a way to do the reverse? That is, can I ensure a more stable connection by using one terminal to open multiple SSH TCP connections for faster speed and redundancy?

My workplace sometimes suffers from serious problems and because TCP allocates resources based on number of connections, I'm pretty sure I can improve the situation by establishing 2 tcp connections for the terminal.

Re:SSH Multiplexing & other OpenSSH Tricks by dedward on Tuesday August 24, 2010 @12:56AM (#1629021)
TCP was designed to assume that packet loss was due to contention... so if you have random or other non-contention-related packet loss, your sessions will slow to a crawl. In this case multiplexing might make things worse than separate sessions... but you're probably just as screwed either way. What you really need to do is just get them to fix the random packet loss problem you probably have.
Re:SSH Multiplexing & other OpenSSH Tricks by kentnl on Saturday August 21, 2010 @09:35PM (#1624014)
+1 just for the multiplex magic, But then, I /would/ say that =)

That TTL thing is handy too, I'm sure I had some understanding of it previously, but reading the article made me check my settings and made me realize my timeouts were ridiculously low so even short disconnections killed my session.

Re:SSH Multiplexing & other OpenSSH Tricks by guac on Sunday August 22, 2010 @02:08AM (#1624301)
For the proxy thing you may want to configure your applications to proxy DNS requests as well. Some do not do it by default and would leak the hostnames you're connecting to.

In firefox the about:config variable is "network.proxy.socks_remote_dns". Set it to true.

Re:SSH Multiplexing & other OpenSSH Tricks by surki on Sunday August 22, 2010 @12:19AM (#1624212)
Re:SSH Multiplexing & other OpenSSH Tricks by luu on Sunday August 22, 2010 @01:05AM (#1624260)
I wish cygwin supported multiplexing. Emacs + TRAMP is noticeably slower for me when I'm running on Windows. Anyone have a good workaround or alternative?
Re:SSH Multiplexing & other OpenSSH Tricks by joeshaw on Saturday August 21, 2010 @09:47PM (#1624037)
Re:SSH Multiplexing & other OpenSSH Tricks by fragmede on Sunday August 22, 2010 @12:17AM (#1624208)
'-t' is also useful if you have machines behind a NAT you want to get to: ssh -t gateway.example.com ssh protected_machine
Re:SSH Multiplexing & other OpenSSH Tricks by mooism2 on Sunday August 22, 2010 @12:53PM (#1624869)
Or you could add the following to your ~/.ssh/config instead:

    Host protected_machine other_protected_machine
    ProxyCommand /usr/bin/ssh gateway.example.com /bin/nc -w 3700 %h %p
(Assumes you have /bin/nc installed on your gateway.)
Re:SSH Multiplexing & other OpenSSH Tricks by est on Sunday August 22, 2010 @12:55AM (#1624249)
just to be clear, multiplexing happens on the client side, right? What's the difference between multiplexing and ssh-proxy?
Re:SSH Multiplexing & other OpenSSH Tricks by kentnl on Sunday August 22, 2010 @04:44AM (#1624401)
Multiplexing is multiplexing. That is, encoding multiple data streams across one channel. In our case, thats having a singular SSH connection from a to b, but having multiple streams of bidirectional data flowing across that singular connection. https://secure.wikimedia.org/wikipedia/en/wiki/Multiplexing So no, multiplexing is started on the client side, and then it happens on server side too. There has to be a multiplex ( many to 1 ) and demultiplex ( 1 to many ) in order for "multiplexing" to occur.