cancel
Showing results for 
Search instead for 
Did you mean: 

ssh tunnel in inittab

Mark McDonald_2
Trusted Contributor

ssh tunnel in inittab

Hi All

I'm having some issues with an ssh tunnel.

I have a basic perl server that listens on port 8890, it accepts a command and runs it locally and returns the output. I also have a perl client that takes hostname, port, command as arguments. When I run the client with port 8890 it connects and runs the command.

I am testing on the local machine for now.

Tunnel is created with:
ssh -fN -L 7777:localhost:8890 root@localhost

Then the client connects to 7777 and also works fine.

If I put the ssh command in to the inittab with the "-f" init looses it and keeps respawning. So the command in inittab is ssh -N -L 7777:localhost:8890 root@localhost.

This does not allow the client to connect.

I added the -f back to the inittab and I get 10 of the ssh processes fire off, but the client works again.

why? is there some other ssh switch for inittab?

I eventually want the server program on 4 machines, with ssh tunnels from another machine so that the client can just fire commands down the relevant port locally, rather than having to ssh in and run the command each time.

Any ideas appreciated.

Mark
2 REPLIES
Mark McDonald_2
Trusted Contributor

Re: ssh tunnel in inittab

found it after another look on google

ssh -nNTx -L etc etc

Mark McDonald_2
Trusted Contributor

Re: ssh tunnel in inittab

solution above.