Re: can sshclient execute a local command ?



On Martes 21 Julio 2009 12:29:44 J. Bakshi escribió:
Hello list,

I have openssh-client __1:5.1p1-5+b1 installed in my debian box. I have
remote ssh information stored in my .ssh/config file. I have protected one
remote ssh by fwknop. When I need ssh login to that particular sever I have
to open the port with fwknop client installed in my local box. Is there any
option in sshclient so that It can execute a local command ( here the
fwknop obviously ) before doing ssh to that remote server ?

Thanks

You can do something like that defining some alias on /etc/bashrc

alias ssh="function dossh { fwknop -A \"tcp/22\" -s -D \$1; /usr/bin/ssh -l
myuser \$1; }; dossh "

Then: ssh myhost

Moreover... for more complex expresion... you can add the user parameter as
$2, add if's if you want, or even use the $@ and extract the hostname from the
parameters to use it on fwknop and use the rest of the argument on -A and ssh
command.


--
Ing. Aaron G. Mizrachi P.

http://www.unmanarc.com
Mobil 1: + 58 416-6143543
Mobil 2: + 58 424-2412503
BBPIN: 0x 247066C1

Attachment: signature.asc
Description: This is a digitally signed message part.



Relevant Pages