2

I'm looking for a way to easily send commands back to my local computer, while connected to a remote host via ssh. Is this doable via tunnelling? Both systems are UNIXen.

For instance, I am connected to a remote host and through some alias "backwards" I want to do:

user@remote $ backwards echo hi

And the local machine would execute echo hi

2
  • Are you on a Unix system?
    – Paul
    Aug 13, 2011 at 19:51
  • Yes, I am. Both ends in fact.
    – Sarah
    Aug 13, 2011 at 19:53

1 Answer 1

6

Standard SSH implementations do not provide this functionality. You will have to connect back to your local computer:

remote$ ssh "${SSH_CONNECTION%% *}" echo hi

If you are behind a NAT, you can use SSH "remote forwarding" to make the connection:

local$ ssh -R 23456:localhost:22 remote
remote$ ssh -P 23456 localhost echo hi

(With -R, "localhost:22" is the client's "localhost".)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .