Dropbear (sshd)
From iDroid Project
Dropbear implements version 2 of the Secure Shell (SSH) protocol. With this you will be able to ssh your iDroid over TCP.
Contents |
Getting Started
First of all I would like to say that this is not the "proper" way of installing Dropbear. But at this point this solution will suffice.
Required
- Rooted iDroid
- Shell Connectivity (adb working - either tcp or usb)
- Dropbear Files
Recommended
The following is not required, but it is highly recommended as we will need a way of turning the server on and off, and the GScript tool is a very simple way to do that.
- Working Market
- GScript Lite (Market app)
Downloading Dropbear Files
Download Dropbear for Android Here
Download Dropbearkey Here
Download busybox Here
Installing
Ok enough of talk I need ssh!
Uploading Dropbear files to iDroid
1) Connect to the phone using ADB:
TCPIP:
adb connect x.x.x.x:5555 adb shell
USB
adb shell
2) Now remount /system read-write:
su mount -o remount,rw /dev/root /system exit
3) Upload the dropbear file to /system/bin
adb push dropbear /system/bin adb push dropbearkey /system/bin adb push busybox /system/bin
Setting up Dropbear
1) reconnect to the adb shell
adb shell
2) Set the proper mode on the dropbear files and create a symlink for killall command
chmod 755 /system/bin/dropbear chmod 755 /system/bin/dropbearkey chmod 755 /system/bin/busybox ln -s /system/bin/busybox /system/bin/killall
3) Create the Dropbear directory inside /etc
mkdir /etc/dropbear
4) Generate a private rsa key.
dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
Thats it, you are done with the install!
Running the server
To run the server you'll need to execute the dropbear command with some parameters.
Running/Stoping the sshd with Gscript
Remember I told you GScript is recommended? Here is why: It is faster to run/kill the server from the UI!
So open Gscript and create one new script, make sure "Needs SU?" is marked. For the Name field type sshd-on and type this in the box:
dropbear -A -N root -U 0 -G 0 -C alpine -p 22
Note that "apline" is the SSH password for root and can be changed in the script to any password that may be wished.
Now create another script, this time name it sshd-off and type the following in the box:
killall dropbear
You are now done! Just open Gscript and touch the sshd-on script to start the sshd.
Running / Stopping the Server Manually
<EDIT ME PLEASE>
Connecting to the shell
Mac/Linux
Just open a terminal and type:
ssh <idroid_ip>
Type in the password you choose earlier and you should be in.
Windows
Windows users need a program called putty to ssh to a server. First download putty here.
Now open putty and type the idroid ip in the field "Host name", the port should be 22 and connection type SSH. Now click the button Open.
For user type in "root" and then type in the password you choose earlier.
You should now be in the shell.
Aditional cosmetic Setup
The sh shell prompt is quite ugly. Just a #. You can customize that by "echoing" some stuff to the .profile file in /data/local/.profile.
To do that, first mount the /data in read/write mode.
adb shell su mount -o remount,rw /dev/root /data
Now echo something inside the .profile
echo 'PS1="iDroid # "' > /data/local/.profile
your prompt will look something like this:
[root@prometheus] (1.3 MB) [~] # ssh root@192.168.20.11 root@192.168.20.11's password: iDroid # whoami root iDroid #