Install the ssh service on Android and install ssh on android

Source: Internet
Author: User
Tags dropbear

Install the ssh service on Android and install ssh on android

1. Installation conditions

The root permission is required for the mobile phone to install the ssh service. The mobile phone I tested is an engineering prototype, and the root permission is granted by default after the adb is connected;
Other users need to run the command by root first. Some commands may need to be put into the script and put into the mobile phone for running, and switch to the root permission before running the command.

2. Download an object

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

3. logon key

The client uses SecureCRT. to log on with the private key, you must first create a key pair;
Step: "tool"-> "Create public key... ", the key type" DSA "(" RSA "should also be acceptable), leave blank (otherwise, enter a password for Logon), the default length of the key is 1024 bits, select "OpenSSH key format", select a folder to save the key, and generate the Private Key Identity and Public Key Identity. pub;

4. Install busybox

adb remountadb push busybox /system/xbin/adb shelladb shell chmod 0755 /system/xbin/busyboxadb shell busybox --install -s /system/xbin/

5. Install dropbear

Adb remount :: push dropbear-related files to the mobile phone adb push dropbear/system/xbin/adb push dropbearkey/system/xbin/adb push dropbearconvert/system/xbin/adb shell chmod 0744/system/xbin /dropbear *:: Create the directory adb shell mkdir/data/dropbearadb shell mkdir/data/dropbear /. ssh: generate the server key adb shell dropbearkey-t dss-f/data/dropbear/dss_host_key: place the login key on the server adb push Identity. pub/data/dropbear /. ssh/adb shell mv/data/dropbear /. ssh/Identity. pub/data/dropbear /. ssh/authorized_keys: The script will create a user-related configuration file. Otherwise, you cannot log on to adb to push createfiles. sh/data/dropbearadb shell chmod-R 0744/data/dropbearadb shell/data/dropbear/createfiles. sh: Start the server test (the-F option can be removed from the actual application and run in the background) adb shell dropbear-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 remountadb shell rm /system/xbin/dropbearadb shell rm /system/xbin/dropbearkeyadb shell rm /system/xbin/dropbearconvertadb shell rm -rf /data/dropbearadb shell rm /etc/passwdadb shell rm /etc/shadowadb shell rm /etc/groupadb shell rm /etc/gshadowadb shell rm /etc/shellsadb shell rm /etc/profile

7. Reference

Running dropbear on Android


How to install the SSH service in linux?

Rpm-ivh openssh-4.3p2-36.e15.rpm

After installation, run the command whereis ssh and whereis sshd to view the path.

After installation, start it manually:
/Etc/init. d/sshd start
Automatic Start:
Chkconfig sshd on

In addition, remember to open port 22 of the firewall.

How to remotely uninstall and install the apk program when an ssh service is enabled for Android phones

Download the software for upgrade on the official website for repair.
Hope to adopt it.
 

Related Article

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.