Reputation: 1427
I created a custom rom and I want to run dropbear ssh server from a system ( signed ) service ( in order to have the system user privileges ) , but whatever command I try, after entering the password from the ssh client ( putty ) it just disconnects.
Is it even possible to run ssh server as system ?
Is there an alternative to dropbear that I could try ?
Upvotes: 1
Views: 6313
Reputation: 918
I did it by installing optware here are the steps:
We need to install optware to manage packages in the apt-get style inside our android device. Of course, we won’t have all packages apt has, but we will have enough.
To install optware we need to access our device in debug mode this way we can access the console and run the optware install script.
To do so,
device-id:5555
.add the following to the PATH system variable:
/folder_where_you_untar_adt/sdk/platform-tools
now download the optware script for android
adb shell
specifying the command between quotes (otherwise it would not work).run your modified (or not) ./optware-install-via-adb.sh
run adb shell
this opens a shell to your device
if you type ls /data/opt
you should see a start.sh
(this is the
bootstrap for optware)
if you don't look at the optware script output there was some errors (mostly related with some command it could not execute via adb or something).
Now make cd /data/opt
Run start.sh
This should show you a Console and here you can type ipkg list
to see the packages you have available.
This is a SSH server useful to connect to your TV BOX. Here I assume you just runned start.sh
successfully. So inside your BusyBox (Console) do:
ipkg install dropbear
-- to install the dropbeardropbearkey -t rsa -f dropbear_rsa_host_key
dropbearkey -t rsa -f id_rsa
dropbearkey -f id_rsa -y > id_rsa.pub
mkdir /data/dropbear/.ssh
cat id_rsa.pub > /data/dropbear/.ssh/authorized_keys
dropbearconvert dropbear openssh id_rsa id_rsa_openssh
dropbear -r /data/dropbear/dropbear_rsa_host_key -E -s
id_rsa
and id_rsa_openssh
to your clientssh -i id_rsa_openssh [email protected]
Now you should have a busybox prompt in your hands
To ensure each time you reboot the bootstrap gets executed you have to:
Modify /data/opt/start.sh
by adding before the /bin/sh
line:
dropbear -r /data/dropbear/dropbear_rsa_host_key -E -s
Install the app Script Manager
In Script Manager click - Menu - Scripts - Browser and navigate to the file /data/opt/start.sh. Then check the SU, Boot and Net icons.
This way each time your device is rebooted the start.sh
gets
executed with dropbear on.
I hope this helps you in some way,
Best regards
Upvotes: 2