01-25-07 06:32 AM
mike wrote:
> Hi,
>
> I am writing a shell script to connect to my work computer.
>
> If I use the following:
>
> ssh -l $USERID -Y -L LOCAL_HOST_PORT:$WORK_HOST:22 $GATEWAY_HOST
>
> I get the following prompt ( of course with real values but just as a
> principle).
>
> $USERID@$GATEWAY_HOST's password>
>
> I generate a password and input it at the command line.
>
> Then I have to type on the command line:
>
> ssh -Y -L $WORK_HOST
>
> Is it possible to get this in one script or how can avoid typing the
> same information every time I login.
>
> All ideas welcome!
>
> cheers,
>
> //mikael
When I do this I have the port forward command like this:
ssh -l $USERID -L LOCAL_HOST_PORT:$WORK_HOST:22 $GATEWAY_HOST cat -
always running, then I do a
ssh -p $LOCAL_HOST_PORT $WORK_HOST
It doesn't answer your question, but depending on how often you connect
through the tunnel you could just leave it always open.
There are other ways: use autossh to open a reverse ssh tunnel from
$WORK_HOST to localhost and then connect through that. Beware that some
network administrators may see this as circumventing their firewalls (which
it does).
Allistar.
[ Post a follow-up to this message ]
|