Ive got most of the way to getting native sshd working over usb (mainly for shell and winscp), but very murky and not quite there yet. I want to use the built-in sshd, not download an app for it.
Lineageos has a built-in SSHD and ADB allows forwarding from local host:XXXX to the phone on port 22. I've got a sshd_config
file ready (password for now, RSA later), and Terminal + su all working. By trial and error I've found the sshd-start or start-sshd files and I'm probably most of the way there. But its hard to reproduce a trial and error approach and I haven't actually got it there yet.
The furthest I've got is that I can run ssh (client) on the phone and it'll at least try to connect to itself (in another terminal window), but doesn't yet fully reach a shell prompt. It gave errors on /var/run/etc and on missing an 'empty' dir which I manually created and seem to help but I don't really know if that's the right or best way to do it.
Assuming I have a valid config file and a clean install with no changes, what are the basic steps from the start, so.I can enable native sshd, start/stop it manually (not started with system), and access it across adb?
I would like to use /sdcard/sshdata for any keys/config, so they are preserved across installing, and for the moment, password over adb via usb only (not WiFi). I'm happy to mod some sshd-related files in /system and probably need to, but I don't know which I need to change.
What is the simplest recipe to get sshd available so that I can fire it up and connect when needed?