Re: can sshclient execute a local command ?



ProxyCommand is king.

How about this in ~/.ssh/config:

Host secret.server.com
ProxyCommand /some/path/fwknopssh secretfwknopparam %h
Host othersecret.server.com
ProxyCommand /some/path/fwknopssh othersecret %h

And then /some/path/fwknopssh being:

#!/bin/bash
param=$1
host=$2
# Do something with $param, e.g. run fwknop. I just:
echo $param > /tmp/fwknop
nc -w 1 $host 22

I got the "secretfwknopparam" and "othersecret" to end up in /tmp/fwknop before logging in to the servers.

Does that work for you?

Peter
--
Peter Valdemar Mørch
http://www.morch.com



Relevant Pages

  • Re: Examples of ProxyCommand?
    ... have to connect to a host which is not directly reachable. ... So lets assume, you have a client computer C, with ssh installed. ... man 5 ssh_config (look for ProxyCommand) ... $ channel 2: open failed: connect failed: Operation not permitted ...
    (comp.security.ssh)
  • Re: Examples of ProxyCommand?
    ... have to connect to a host which is not directly reachable. ... So lets assume, you have a client computer C, with ssh installed. ... This gives you a connection from C to H, and you can setup a tunnel: ... man 5 ssh_config (look for ProxyCommand) ...
    (comp.security.ssh)
  • Re: ssh Kommandozeilenoptionen in ssh_config umsetzen
    ... ProxyCommand hindurch direkt mit dem sshd auf dem Zielhost ... ProxyCommand ersetzt die TCP-Verbindung zwischen ... Neuanlegenlassen von Host Keys in known_hosts wird nun immer unter anderem ... key; host2 möchte hingegen ein Passwort erhalten. ...
    (de.comp.os.unix.apps.misc)
  • Re: ssh Kommandozeilenoptionen in ssh_config umsetzen
    ... ProxyCommand hindurch direkt mit dem sshd auf dem Zielhost ... ProxyCommand ersetzt die TCP-Verbindung zwischen ... Neuanlegenlassen von Host Keys in known_hosts wird nun immer unter anderem ... key; host2 möchte hingegen ein Passwort erhalten. ...
    (de.comp.os.unix.apps.misc)
  • Re: How do I use ProxyCommand to connect to remote host using shared session enabled by ControMaster
    ... I suppose you cannot do that since host * provides defaults for all ... ProxyCommand to jumphost. ... ProxyCommand to none, not an empty string, as stated in ssh_config ... hostname remotehost.example.net ...
    (SSH)