How to use terminal on your Android device?

How to use terminal on your Android device?

How to use terminal on your Android device? 150 150 Webkey

The Webkey Terminal feature enable real-time pseudo terminal access to your Android devices.  In this tutorial we will demonstrate how to install and run Debian Linux applications on your Android in chroot jail environment.

To make it work, you will need:

  • A rooted Android device
  • Debian Linux distribution on your PC
  • Installed applications on your PC: chroot, qemu-user-static
  • Webkey Client App (Free)

Prepare the chroot environment on the PC

  1. On the PC, create a folder and generate a formatted, mountable image. 
  2. Install a Debian Buster linux inside the chroot environment with the debootstrap command.
  3. Upload this image (debian.img) to your web server to download it later
mkdir -p webkey/tutorial
cd webkey/tutorial
dd if=/dev/zero of=debian.img bs=1024 count=614400
sudo mkfs.ext2 -F debian.img
sudo tune2fs -c0 debian.img
mkdir debian
sudo mount -o loop debian.img debian/
sudo debootstrap --verbose --foreign --arch armel buster debian http://ftp.de.debian.org/debian
sudo chroot debian
export LC_ALL=C
debootstrap/debootstrap --second-stage

On your Android device

  1. Download the Webkey Client App to your device
  2. Install and register an account

On your PC

  1. Open https://webkey.cc/dashboard/ and sign in to your account
  2. Select your device from the list and launch the terminal
  3. Create a new folder and download the image file created earlier (debian.img)

    su
    cd /data/media/0
    mkdir debian
    curl -s -k https://webkey.cc/public/chroot/debian_arm.img > debian.img
    
  4. Mount the image and use busybox to change chroot to this environment

    mount -t ext2 -o loop debian.img debian
    curl -s -k https://webkey.cc/public/chroot/busybox > busybox
    chmod 755 busybox
    ./busybox chroot debian /usr/bin/bash
    
  5. Now you can act as a Debian distribution
  6. Try running Midnight Commander as an example. How cool is that? 💪