OpenWrt Forum Archive

Topic: startup script - open ssh session

The content of this topic has been archived on 1 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello,

to get internet access, a LAN provider requires the user to open a ssh session to remote host with username and password and hold the session open as long as the user wants to have internet access.

I want this to be done by wlan router TL-WR841N with openwrt at startup.

The following script shall be automatically executed at startup

while true
do
   DROPBEAR_PASSWORD='PASSWORD' ssh -y USERNAME@remote.host
   sleep 5
done 

Will this script work on openwrt?
What do I have to do for automatic execution?

Regards,
Erwin

'ssh -y' -> always accept server key if unknown

(Last edited by Erwin on 23 Oct 2017, 13:44)

Try to run the script manually initially, what is the problem?

There is still DD-WRT on the TL-WR841N.

But unfortunately the DROPBEAR_PASSWORD functionality of dbclient seem's to be broken in DD-WRT. Thus the startup script hangs at password input.

Now I'm looking for an alternative solution for an ehternet router with WLAN and optional user startupt script.

Install OpenWRT and try manually, what is the problem?

Am I right, that with only 4MB flash of my TL-WR841N V9 I won't get a webinterface for openwrt?

I think, yes.

TL-WR841N v9 has 15.05.1 support -> LuCI included, but most probably only very little space left to install anything else.

Thanks.

I want to use it as ethernetrouter + wlan + additional custom startup script (establish and hold a ssh connection)

while true
do
   DROPBEAR_PASSWORD='PASSWORD' ssh -y USERNAME@remote.host
   sleep 5
done 

Will there be enough space left to store this script?
I only know the NVRAM method from dd-wrt to store the script in the rc_startup variable.
How this has to be done in openwrt?
Is there a permanent storage location with 4 MB flash?

In ordinary filesystem. Have you used OpenWRT before?

The discussion might have continued from here.