What's new

Dropbear process not ending on exit

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Traste

Occasional Visitor
Hi,

I am running Firmware:380.60_beta2 on an Asus RT-AC68U and from a machine, i am running a monitoring script over SSH every few minutes, this is working great, however after a day or two, the router started acting up, disconnected from the internet, stopped responding to SSH connections, but the http/https was working so i restarted the router.
After manually monitoring the router for a while i noticed that the number of dropbear processes started to build up over time so I figured that my script didn't close the SSH session properly when closing the , so i changed the script to run "exit" at the end, but that doesnt seem to help, they are still building up.
Is this expected behaviour when running exit?
I tried to kill the processes from the script using "killall dropbear" , but that stops SSH from working all together.
I was also considering doing a "/etc/init.d/ssh stop ; /etc/init.d/dropbear start" at the end of the script, but both and killing the processes feels a little heavyhanded and would stop other sessions as well.
Am I doing something wrong, does anyone have any suggestions on how to get around this issue?

Much appreciated,

Traste
 
Does your script run anything that might be left running in background after disconnecting?

I log a lot into my router over SSH, and never had any issue with leftover processes.

Might also be worth upgrading, I don't think this beta has the latest dropbear version.
 
Hi RMerlin,

all it does is execute "cat /proc/net/arp" and i changed that to "cat /proc/net/arp; exit"
There are two other scripts that only run once a day each to turn on and off the guest wifi, and that has been running fine for months or rather - at least i didnt notice any issue, but i have had to do a restart or two over the months and maybe that was causing it.

I will start with doing an update and see if that helps.
 
I would also check with netstat to confirm whether the client actually disconnects or not.
 
Hi again,
I updated to Firmware: 380.63 and then left the script running every minute for about an hour, i checked with PS and counted 64 instances of dropbear:
4782 admin 1136 S dropbear -p 192.168.1.1:22 -a -j -k

i tried running netstat and sure enough, it lists these as
"tcp 0 0 router.asus.com:ssh 192.168.1.205:50804 ESTABLISHED"
i will need to check on the script to make sure it ends the session on its end as well.
Still, i would have expected the exit command at the end to close the session as it would with Putty for example, but i am no expert.
Thank you very much for your help, i now understand that this is not an issue with Merlin but with my script, sorry for wasting your time.
 
how can I start / stop / restart dropbear
usually this is done via service stop_$NAME$
but dropbear is started differently (runit/init.d ?? no clue about those 2)
right now when I kill it (to make sure no leftover sessions are blocking a drive I want to unmount at a certain time),the cron job script kills dropbear.
And when I want to ssh into the router later again,I have to open the webGUI/Administration/system,press the apply button,then dropbear is restarted.

any way I can stop / start (restart) dropbear from within a script ?
 
how can I start / stop / restart dropbear
usually this is done via service stop_$NAME$
but dropbear is started differently (runit/init.d ?? no clue about those 2)
right now when I kill it (to make sure no leftover sessions are blocking a drive I want to unmount at a certain time),the cron job script kills dropbear.
And when I want to ssh into the router later again,I have to open the webGUI/Administration/system,press the apply button,then dropbear is restarted.

any way I can stop / start (restart) dropbear from within a script ?


Code:
#!/bin/sh

# Monitor SSH task and auto restart if it goes AWOL
cru a CheckSSHD "*/5 * * * * (/bin/pidof dropbear 2>&1 >/dev/null || /sbin/run_sshd)"
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top