Joe1
January 2, 2021, 9:13pm
1
Hello everyone,
I'm trying to do SSH tunnel that go up on startup.
i wrote initscript:
#!/bin/sh /etc/rc.common
START=99
boot() {
while true
do
ssh -fN -R 0.0.0.0:80:127.0.0.1:80 root@server -i /root/identityFile
sleep 10
done
}
The ssh command alone is running well but the initscript isn't running.
I would appreciate your assistance
Joe
trendy
January 2, 2021, 10:10pm
2
It would be simpler to add that to rc.local.
Did you make it executable?
Did you enable it?
Joe1
January 2, 2021, 10:34pm
3
As you suggested, I changed it to rc.local.
and for both of your questions. yes its executable and enabled.
Still not working.
trendy
January 2, 2021, 10:46pm
4
I suppose you added the ssh command only in the rc.local file, right?
Joe1
January 2, 2021, 10:49pm
5
like this:
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
ssh -fN -R 0.0.0.0:80:127.0.0.1:80 root@server -i /root/identityFile
exit 0
While ago i tried to put while loop and my router stocked in boot loop
trendy
January 3, 2021, 12:41am
6
It won't work as it is ( lack of shell or something like that)
A couple of solutions:
https://github.com/warybyte/ssh-callback (be careful with the paths, not exactly the same with OpenWrt)
https://www.everythingcli.org/ssh-tunnelling-for-fun-and-profit-autossh/ (exists in opkg, should be the best to use).
Joe1
January 3, 2021, 5:14pm
7
Thank you.
It's works well.
Thank you very much
trendy
January 3, 2021, 5:17pm
8
Which one did you use? Could you post the command line you used as well?
1 Like
Joe1
January 4, 2021, 4:29am
9
I used this guide:
If any one will ever want toy do autossh, this guide is more relative to Openwrt and pay attention to the known bug in the guide:
https://openwrt.org/docs/guide-user/services/ssh/autossh
2 Likes
system
Closed
January 14, 2021, 4:29am
10
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.