Wednesday, March 4, 2009

How to confuse ssh

I'm sure there are lots of ways to confuse ssh, just like there lots of ways to confuse me. But this is the one i found.

At work we run Solaris with lots of old tools. I end up building lots of new stuff for my self and then having to work around the old ones. When I worked in a Irix shop, I had to do the same thing but for different reasons.

One of the oddities that I run into is that our login shells are often csh. I like bash or ksh in a pinch. Well this means that I had to hack together a .cshrc that checks for bash and then execs it, leaving me with a perfect world of bash.

It looks something like this:

if ( $_ == "/bin/which" || $_ == "/usr/bin/which" ) then
set which="true"

set BASH = "$PWD/bin/bash"

if ( -x $BASH && $which != "true" ) then
exec $BASH

set BASH = "/usr/bin/bash"

if ( -x $BASH && $which != "true" ) then
exec $BASH
Well ssh does not like this for executing remove commands. When a login shell does that it confuses remove commands but not the remove login one.

For example running: ssh removeserver date would just hang. The debugging output would even say: debug1: Sending command: date then just stop. Unless you add the -t option then it would drop you into a shell.

Very confusing and frustrating, especially when mixed with ProxyCommand and netcat which just does nothing. Or running ssh -t remoteserver ssh nextserver which just drops into a shell on the remoteserver. Then hair pulling occurs :)

I updated to exit before running the bash shell for certain hosts:
if ( `hostname` == 'remoteserver' ) then
Lets just say that it made my afternoon quite unpleasant until I found the solution.


  1. Useful Information……
    Recruitment voice contains Daily GK Updates, Bank Recruitment, Government jobs, Bank jobs, Interview Tips, Banking News, GK Updates Bank Recruitment

  2. Nice Information:
    Telugu Cinema Contains Telugu Cinema News, Latest Movie Reviews, Actor, Actress, Movie Galleries And Many More Telugu Cinema News

  3. We are ERPTREE Leading oracle fusion HCM Online Training institute. We are providing online training services since 1999. still we are adding more oracle related courses as the technology changes.
    2000+ online courses are available. we all ways achieve our goal in satisfying students in result we have global recognition to our site. we have best faculty for all of our online courses.

    Oracle fusion HCM Online Training

    Oracle Fusion HCM Training

  4. Thanks for sharing nice information, Hope you will share many more articles.

    Oracle Fusion Financials Online Training