To fix this, add the following key to /System/Library/LaunchDaemons/dropbear.plist
<key>KeepAlive</key>
<true/>
@eriksmets It's not an issue, dropbear comes with a default session timeout of 3 consecutive keepalives.
It's more to security than to keep the services going on. Yes you can change the parameters provided to keep it alive, but it's not recommended as a default value.
If no response is received after 3 keepalives then the session is terminated.
As stated in the https://matt.ucc.asn.au/dropbear/CHANGES
Is the launchd's keepalive not a different thing then dropbear's session keepalive ?
Launchd's keepalive relaunches dropbear after exit/crash.
@shdkpr2008 Do you have to reboot the device (and re-jailbreak) in order to restart the session, or is there a command you can use to restart it in terminal?
I am thinking about making a proper dropbear deb with this fixed.
@eriksmets A keepalive in its terminology is same either you define in a program itself or define in a launcher that launches a program. A launcher can do many other things as well as a program but since program itself have many other purposes than launching and monitoring the programs for which only a launcher is designed keeping things in mind.
Yes it's a different thing is many ways like your launchd(launcher daemon) launches programs at boot time as well and its purpose is well defined, so it keeps a good track of program and keep them alive not same as defined in dropbear's internals. For dropbear's session keepalive its designed to work onces dropbear actaully executes and load itself. The launchd launcher have advantages of being developed specifically for the kind of environment(mach/ios) to keep the things go smoothly.
There's a conceptual error if you add keepalive in launchd plist for dropbear, consider everytime dropbear hits the session timeout it will terminate itself, catching the termination launchd will try to start it again as you stated it to be keptalive. That wouldn't be a good choice.
Yes it does keep it alive even after a crach, that's what it's designed for.
The aim to use dropbear here *shouldn't be to keep it alive all the time but provide the basic terminal access for a users who just got jail-broken, if one wishes to keep the services going on, one can modify the basic settings to suit the type of environment he like.
*Its my opinion
@Platypus2 you can use the following terminal command to launch any daemon at will.
launchctl load /path/to/program.plist
As in this case it will be :
launchctl load /Library/LaunchDaemons/dropbear.plist
Edit : Thus if you want to restart dropbear after a session timeout termination run the above command.
Note: The dropbear must be dead/terminated, other wise _unload_ first and then _load_.