Android Installation SSH Service

Source: Internet
Author: User

1. Installation conditions

Need to install the SSH service needs to have root access to the phone, I test the use of the mobile phone is an engineering prototype, ADB connection on the default after the root authority;
Other users need root before they can do it, they may need to put some commands into the script, run them on the phone, and switch to root before running.

2. Download the file

BusyBox http://www.busybox.net/downloads/binaries
Dropbear Http://www.cri.ch/sven/lib/exe/fetch.php/blog/dropbear.zip

3. Login Key

The client is using SECURECRT, and the key pair must be created first because the private key is used to log in.
Steps: "Tools", "Create Public key ...", the key Type "DSA" ("RSA" should also be possible), the passphrase is left blank (otherwise login needs to enter a password), the key length default 1024 bits, select "OpenSSH key Format", select a folder to save the key, Both the private key identity and the public key identity.pub are generated;

4, Installation BusyBox

/system/xbin/shellShell chmod 0755/system/xbin/Shell BusyBox--install-s/system/xbin/

5, installation Dropbear

adb remount::push dropbear related files into the phoneADB push dropbear/system/xbin/adb push Dropbearkey/system/xbin/adb push Dropbearconvert/system/xbin/adbShellchmod 0744/system/xbin/dropbear*::Create a dropbear directoryadbShell mkdir/data/dropbearadbShell mkdir/data/dropbear/.SSH::generate a server keyadbShellDropbearkey-t dss-f/data/dropbear/Dss_host_key::Place the login key on the serverADB push identity.pub/data/dropbear/.ssh/adbShellmv/data/dropbear/.ssh/identity.pub/data/dropbear/.ssh/Authorized_keys::The script creates a user-related profile, otherwise it cannot be logged inADB push createfiles.sh/data/dropbearadbShellChmod-r 0744/data/dropbearadbShell/data/dropbear/createfiles.SH::start the server test(actual application can remove the-f option, run in the background) ADBShelldropbear-d/data/dropbear/dss_host_key-f-e-s-V

createfiles.sh Content:

Echo "root:x:0:0::/root:/system/bin/sh">/etc/passwdEcho "root::14531:0:99999:7 :::">/etc/ShadowEcho "root:x:0:">/etc/GroupEcho "root:!::">/etc/GshadowEcho "/system/bin/sh">/etc/ShellsEcho "path=\ "/usr/bin:/usr/sbin:/bin:/sbin:/system/sbin:/system/bin:/system/xbin:/data/local/bin\"">/etc/ ProfileEcho "Export PATH">>/etc/profile

6, uninstall Dropbear

adb remountadbShellrm/system/xbin/dropbearadbShellrm/system/xbin/dropbearkeyadbShellrm/system/xbin/dropbearconvertadbShellrm-rf/data/dropbearadbShellrm/etc/passwdadbShellrm/etc/shadowadbShellrm/etc/groupadbShellrm/etc/gshadowadbShellrm/etc/shellsadbShellRm/etc/profile

7. Reference

Running Dropbear on Android:http://www.cri.ch/sven/doku.php/blog/running-dropbear-on-android

Android Installation SSH Service

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.