A continuation of Reliable SSH Tunnel, forked from RSTunnel but I want simply deployment.
I like use ssh config to control SSH Tunnel, so I alter RSTunnel, just use simple config for ssh.
The code of CTunnel have many snip from RSTunnel, now just worked. But I will improve it.
- put
ctunnel
to~/bin/
mkdir ~/bin
cp ctunnel ~/bin/
~/.ssh/config.myserver
(myserver
is the "Host" in config )
cp config.myserver.example ~/.ssh/config.myserver
- add
config.myserver
include in~/.ssh/config
echo "Include ~/.ssh/config.myserver" >> ~/.ssh/config
-
please change config to your env:
- Host
- HostName
- LocalForward
- RemoteForward
-
create a SSH RSA key without password:
mkdir -p ~/.ssh/no_pw
ssh-keygen -f ~/.ssh/no_pw/id_rsa
please not use password to protect id_rsa
- add a crontab to run
ctunnel
every minutes:
crontab -e
add follow line:
* * * * * /home/admin/bin/ctunnel
- Now just work, but I need add help and options