How do I install DropBear SSH on Android? I would like to install DropBear SSH on my 64 bit Android 5.1 device, but it seems that all the installation tutorials and how-tos have disappeared or contain links to broken files/downloads.  

Could someone please explain the proper way to accomplish this?

FURTHER DETAILS:


This question comes from this other: an attempt to install some SSH Server on a modern (September 2015 at least) Android device that has (nearly) failed with many tested apps. Command line installation of Dropbear is a different approach to the problem.
First as a side-note for other readers: We're not talking about "an app" here (those have already been tried and didn't work on that architecture), but about a command-line binary. DropBear sometimes is part of Busybox, or it comes as separate binary.



Now for the installation part. Binaries you install yourself best go to /system/xbin, which is in the $PATH but usually "initially empty" (Android's own stuff is in /system/bin and /system/sbin), so we run a very low risk of "collisions". So either adb shell or terminal to your device and make sure you're root. I further assume you've already transferred the dropbear/busybox binary to your SD card.


mount -o remount,rw /system        # make sure we can write to system
cp /sdcard/busybox /system/xbin    # copy the binaries to /system/xbin
cp /sdcard/dropbear /system/xbin
cd /system/xbin                    # switch to our target directory
chmod 755 busybox dropbear         # make sure we've set the correct permissions
busybox --install /system/xbin     # advice busybox to create all its symlinks here


Installation part done (skip the dropbear parts here if your dropbear comes with busybox – and vice versa, skip the busybox part if not needed.

Now, we need to make dropbear fly. I've never tried this myself, so I refer to an external script at Github for that. In short (and in case that link dies), again assuming the required files are already copied to your SD card:


# Creating a home-dir for DropBear
mkdir /data/dropbear
chmod 755 /data/dropbear
mkdir /data/dropbear/.ssh
chmod 700 /data/dropbear/.ssh
# Copy over our files
mv /sdcard/authorized_keys /data/dropbear/.ssh/
chown root: /data/dropbear/.ssh/authorized_keys
chmod 600 /data/dropbear/.ssh/authorized_keys
# Generate a hostkey, so we can use DropBear
dropbearkey -t rsa -f /data/dropbear/dropbear_rsa_host_key
dropbearkey -t dss -f /data/dropbear/dropbear_dss_host_key


An additional part if you want DropBear to auto-start at boot:


cat &lt;&lt; EOF >> /etc/init.local.rc

# start Dropbear (ssh server) service on boot
service sshd /system/xbin/dropbear -s
   user  root
   group root
   oneshot

EOF


Note that this assumes your device supports init.d scripts. First check for the availability of that file to make sure.

Finally, don't forget to make /system read-only again. Either reboot at this point (so you also can check that DropBear starts as intended), or at least execute

mount -o remount,ro /system


for now, postponing the reboot. To start the service manually, it should be possible executing that block via some shell script (so you could e.g. have a tasker task for starting and another one for stopping the daemon, and even make shortcuts to those tasks on your homescreen for manual control). Again, I have not tested this part, so it's "pure theory".

Good luck with DropBear and BusyBox!