Skip to content

Instantly share code, notes, and snippets.

@clevertonh
Forked from raveenb/ssh_into_android.md
Created July 26, 2021 15:20
Show Gist options
  • Save clevertonh/93c4d2ab604a567da47453c655f09eba to your computer and use it in GitHub Desktop.
Save clevertonh/93c4d2ab604a567da47453c655f09eba to your computer and use it in GitHub Desktop.

Revisions

  1. @raveenb raveenb revised this gist Oct 23, 2019. 1 changed file with 10 additions and 8 deletions.
    18 changes: 10 additions & 8 deletions ssh_into_android.md
    Original file line number Diff line number Diff line change
    @@ -4,27 +4,29 @@
    Install Android App Termux from APKPure or AppStore.
    If the app exists, just delete and re-install it to get the latest version,
    The APK can be downloaded from https://apkpure.com/termux/com.termux/
    Install the APK using by running ```adb install ~/Downloads/Termux_v0.73_apkpure.com.apk```
    Install the APK using by running
    ```
    adb install ~/Downloads/Termux_v0.73_apkpure.com.apk
    ```
    Then locate the app and run it

    ## Install and run SSH Server
    Next, Run the following commands inside the Termux using the on device keyboard to type,
    Next, run the following commands inside the Termux using the on device keyboard to type. When the setup asks for permission, always choose default option, you can just hit/tap enter on the keyboard, dont let it modify any configs
    ```
    pkg install root-repo
    pkg upgrade
    pkg install openssh
    ```
    When the setup asks for permission, always choose default option, you can just hit/tap enter on the keyboard, dont let it modify any configs

    Now set a password for the current user by running ```passwd```, remember this password you will need it later
    Now, set a password for the current user by running ```passwd```, remember this password you will need it later

    Start SSH server inside android by running ```sshd```, do not close/exit the app after running the command
    Then, Start the SSH server inside by running ```sshd```, do not close/exit the app after running the command

    ## Connect to SSH Server
    On the pc terminal run the following, dont use ```root@``` as prefix to the ip address
    ```
    ssh <ip address of android device> -p 8022
    ```
    ```
    ssh <ip address of android device> -p 8022
    ```
    When asked for password, enter the password you used in the steps above

    This will drop you into a shell where you can do further installs using ```pkg install <name>``` or run any other command you would like ```wget, curl``` you get a proper linux shell, sweet, enjoy!
  2. @raveenb raveenb revised this gist Oct 23, 2019. 1 changed file with 13 additions and 14 deletions.
    27 changes: 13 additions & 14 deletions ssh_into_android.md
    Original file line number Diff line number Diff line change
    @@ -1,25 +1,24 @@
    # Connecting to an Android device over SSH

    ## Initial Setup
    1. Install Android App Termux from APKPure or AppStore. If the app exists, just delete and re-install it, can be done quickly using
    ```
    adb install ~/Downloads/Termux_v0.73_apkpure.com.apk
    ```

    2. Then run the app inside the android device, locate and tap on it
    Install Android App Termux from APKPure or AppStore.
    If the app exists, just delete and re-install it to get the latest version,
    The APK can be downloaded from https://apkpure.com/termux/com.termux/
    Install the APK using by running ```adb install ~/Downloads/Termux_v0.73_apkpure.com.apk```
    Then locate the app and run it

    ## Install and run SSH Server
    1. Run the following commands inside the Termux using the on device keyboard to type,
    ```
    pkg install root-repo
    pkg upgrade
    pkg install openssh
    ```
    Next, Run the following commands inside the Termux using the on device keyboard to type,
    ```
    pkg install root-repo
    pkg upgrade
    pkg install openssh
    ```
    When the setup asks for permission, always choose default option, you can just hit/tap enter on the keyboard, dont let it modify any configs

    2. Now set a password for the current user by ```passwd```, remember this password you will need it later
    Now set a password for the current user by running ```passwd```, remember this password you will need it later

    3. Start SSH server inside android by running ```sshd```, do not close/exit the app after running the command
    Start SSH server inside android by running ```sshd```, do not close/exit the app after running the command

    ## Connect to SSH Server
    On the pc terminal run the following, dont use ```root@``` as prefix to the ip address
  3. @raveenb raveenb revised this gist Oct 23, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ssh_into_android.md
    Original file line number Diff line number Diff line change
    @@ -46,4 +46,4 @@ then connect again
    There are instances when the pc to android ip connection will wait a long time. If so, first check if you can ping the android's ip address, and if its not pingable, perhaps reboot the android device. Stating the obvious here, unless the android cant be pinged you cant ssh into it.

    ## Reference
    Extracted from Termux's wiki on this topic from here [https://wiki.termux.com/wiki/Remote_Access]
    Extracted from Termux's wiki on this topic from here [https://wiki.termux.com/wiki/Remote_Access] it describes alternate ways using Dropbear, Mosh and RSync
  4. @raveenb raveenb revised this gist Oct 23, 2019. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions ssh_into_android.md
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@

    2. Then run the app inside the android device, locate and tap on it

    ## Install and run SSH Server on Android Device
    ## Install and run SSH Server
    1. Run the following commands inside the Termux using the on device keyboard to type,
    ```
    pkg install root-repo
    @@ -21,7 +21,7 @@ When the setup asks for permission, always choose default option, you can just h

    3. Start SSH server inside android by running ```sshd```, do not close/exit the app after running the command

    ## Connect to SSH Server running on Android Device
    ## Connect to SSH Server
    On the pc terminal run the following, dont use ```root@``` as prefix to the ip address
    ```
    ssh <ip address of android device> -p 8022
    @@ -30,7 +30,7 @@ When asked for password, enter the password you used in the steps above

    This will drop you into a shell where you can do further installs using ```pkg install <name>``` or run any other command you would like ```wget, curl``` you get a proper linux shell, sweet, enjoy!

    ## Disconnect and stop SSH Server on Android Device
    ## Stop SSH Server
    Once you are done working with the shell, stop the ssh server by running ```pkill sshd``` on the device

    ## Troubleshooting
  5. @raveenb raveenb revised this gist Oct 23, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ssh_into_android.md
    Original file line number Diff line number Diff line change
    @@ -45,5 +45,5 @@ then connect again
    ### Waiting forever to connect
    There are instances when the pc to android ip connection will wait a long time. If so, first check if you can ping the android's ip address, and if its not pingable, perhaps reboot the android device. Stating the obvious here, unless the android cant be pinged you cant ssh into it.

    ### Reference
    ## Reference
    Extracted from Termux's wiki on this topic from here [https://wiki.termux.com/wiki/Remote_Access]
  6. @raveenb raveenb revised this gist Oct 23, 2019. 1 changed file with 6 additions and 4 deletions.
    10 changes: 6 additions & 4 deletions ssh_into_android.md
    Original file line number Diff line number Diff line change
    @@ -9,24 +9,26 @@
    2. Then run the app inside the android device, locate and tap on it

    ## Install and run SSH Server on Android Device
    1. Run the following commands inside the app, use the on device keyboard, (choose default option when asked question, just hit enter)
    1. Run the following commands inside the Termux using the on device keyboard to type,
    ```
    pkg install root-repo
    pkg upgrade
    pkg install openssh
    ```
    When the setup asks for permission, always choose default option, you can just hit/tap enter on the keyboard, dont let it modify any configs

    2. Set a password for the current user by ```passwd```, remember this password you will need it later
    2. Now set a password for the current user by ```passwd```, remember this password you will need it later

    3. Start SSH server inside android by running ```sshd```, do not close/exit the app after running the command

    ## Connect to SSH Server running on Android Device
    1. On the pc terminal run the following, dont use ```root@``` as prefix to the ip address
    On the pc terminal run the following, dont use ```root@``` as prefix to the ip address
    ```
    ssh <ip address of android device> -p 8022
    ```
    When asked for password, enter the password you used in the steps above

    2. This will drop you into a shell where you can do further installs using ```pkg install <name>``` or run any other command you would like ```wget, curl``` you get a proper linux shell, sweet, enjoy!
    This will drop you into a shell where you can do further installs using ```pkg install <name>``` or run any other command you would like ```wget, curl``` you get a proper linux shell, sweet, enjoy!

    ## Disconnect and stop SSH Server on Android Device
    Once you are done working with the shell, stop the ssh server by running ```pkill sshd``` on the device
  7. @raveenb raveenb revised this gist Oct 23, 2019. 1 changed file with 18 additions and 10 deletions.
    28 changes: 18 additions & 10 deletions ssh_into_android.md
    Original file line number Diff line number Diff line change
    @@ -1,39 +1,47 @@
    # Connecting to an Android device over SSH

    ## Initial Setup
    1. Install Android App Termux from APKPure or AppStore. If the app exists, just delete and re-install it, can be done quickly using
    ```
    adb install ~/Downloads/Termux_v0.73_apkpure.com.apk
    ```

    2. Then run the app inside the android device, locate and tap on it

    3. Run the following commands inside the app, use the on device keyboard, (choose default option when asked question, just hit enter)
    ## Install and run SSH Server on Android Device
    1. Run the following commands inside the app, use the on device keyboard, (choose default option when asked question, just hit enter)
    ```
    pkg install root-repo
    pkg upgrade
    pkg install openssh
    ```

    4. Set a password for the current user by ```passwd```, remember this password you will need it later
    2. Set a password for the current user by ```passwd```, remember this password you will need it later

    5. Start SSH server inside android by running ```sshd```, do not close/exit the app after running the command
    3. Start SSH server inside android by running ```sshd```, do not close/exit the app after running the command

    6. On the pc terminal run the following, dont use ```root@``` as prefix to the ip address
    ## Connect to SSH Server running on Android Device
    1. On the pc terminal run the following, dont use ```root@``` as prefix to the ip address
    ```
    ssh <ip address of android device> -p 8022
    ```

    7. This will drop you into a shell where you can do further installs using ```pkg install <name>``` or run any other command you would like ```wget, curl``` you get a proper linux shell, sweet, enjoy!
    2. This will drop you into a shell where you can do further installs using ```pkg install <name>``` or run any other command you would like ```wget, curl``` you get a proper linux shell, sweet, enjoy!

    8. Once you are done working with the shell, stop the ssh server by running ```pkill sshd``` on the device
    ## Disconnect and stop SSH Server on Android Device
    Once you are done working with the shell, stop the ssh server by running ```pkill sshd``` on the device

    ---
    ## SSH not connecting
    ## Troubleshooting
    ### Host key verification error
    If for some odd reason you are getting Host key verification failed error, run the following first
    ```
    ssh-keygen -R <ip address of android device>
    ```

    If it still gives you trouble edit ```~/.ssh/known_hosts```, locate the line(s) with the ip address and delete it and
    then connect again

    ---
    ### Waiting forever to connect
    There are instances when the pc to android ip connection will wait a long time. If so, first check if you can ping the android's ip address, and if its not pingable, perhaps reboot the android device. Stating the obvious here, unless the android cant be pinged you cant ssh into it.

    ### Reference
    Extracted from Termux's wiki on this topic from here [https://wiki.termux.com/wiki/Remote_Access]
  8. @raveenb raveenb revised this gist Oct 23, 2019. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions ssh_into_android.md
    Original file line number Diff line number Diff line change
    @@ -26,11 +26,13 @@
    8. Once you are done working with the shell, stop the ssh server by running ```pkill sshd``` on the device

    ---
    1. If for some odd reason you are getting Host key verification failed error, run the following first
    ## SSH not connecting
    If for some odd reason you are getting Host key verification failed error, run the following first
    ```
    ssh-keygen -R <ip address of android device>
    ```
    2. If it still gives you trouble edit ```~/.ssh/known_hosts```, locate the line(s) with the ip address and delete it and

    If it still gives you trouble edit ```~/.ssh/known_hosts```, locate the line(s) with the ip address and delete it and
    then connect again

    ---
  9. @raveenb raveenb revised this gist Oct 23, 2019. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions ssh_into_android.md
    Original file line number Diff line number Diff line change
    @@ -23,11 +23,14 @@

    7. This will drop you into a shell where you can do further installs using ```pkg install <name>``` or run any other command you would like ```wget, curl``` you get a proper linux shell, sweet, enjoy!

    8. If for some odd reason you are getting Host key verification failed error, run the following first
    8. Once you are done working with the shell, stop the ssh server by running ```pkill sshd``` on the device

    ---
    1. If for some odd reason you are getting Host key verification failed error, run the following first
    ```
    ssh-keygen -R <ip address of android device>
    ```
    If it still gives you trouble edit ```~/.ssh/known_hosts```, locate the line(s) with the ip address and delete it and
    2. If it still gives you trouble edit ```~/.ssh/known_hosts```, locate the line(s) with the ip address and delete it and
    then connect again

    ---
  10. @raveenb raveenb revised this gist Oct 23, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ssh_into_android.md
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,7 @@
    ssh <ip address of android device> -p 8022
    ```

    7. This will drop you into a shell where you can do further installs using ```pkg install <name>``` or run any other command you would like ```wget, curl``` you get a proper linux shell, enjoy!
    7. This will drop you into a shell where you can do further installs using ```pkg install <name>``` or run any other command you would like ```wget, curl``` you get a proper linux shell, sweet, enjoy!

    8. If for some odd reason you are getting Host key verification failed error, run the following first
    ```
  11. @raveenb raveenb revised this gist Oct 23, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ssh_into_android.md
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,7 @@
    ssh <ip address of android device> -p 8022
    ```

    7. This will drop you into a shell where you can do further installs using ```pkg install <name>```
    7. This will drop you into a shell where you can do further installs using ```pkg install <name>``` or run any other command you would like ```wget, curl``` you get a proper linux shell, enjoy!

    8. If for some odd reason you are getting Host key verification failed error, run the following first
    ```
  12. @raveenb raveenb revised this gist Oct 23, 2019. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion ssh_into_android.md
    Original file line number Diff line number Diff line change
    @@ -30,4 +30,5 @@
    If it still gives you trouble edit ```~/.ssh/known_hosts```, locate the line(s) with the ip address and delete it and
    then connect again

    Extracted from [https://wiki.termux.com/wiki/Remote_Access]
    ---
    Extracted from Termux's wiki on this topic from here [https://wiki.termux.com/wiki/Remote_Access]
  13. @raveenb raveenb revised this gist Oct 23, 2019. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion ssh_into_android.md
    Original file line number Diff line number Diff line change
    @@ -28,4 +28,6 @@
    ssh-keygen -R <ip address of android device>
    ```
    If it still gives you trouble edit ```~/.ssh/known_hosts```, locate the line(s) with the ip address and delete it and
    then connect again
    then connect again

    Extracted from [https://wiki.termux.com/wiki/Remote_Access]
  14. @raveenb raveenb revised this gist Oct 23, 2019. 1 changed file with 2 additions and 5 deletions.
    7 changes: 2 additions & 5 deletions ssh_into_android.md
    Original file line number Diff line number Diff line change
    @@ -14,12 +14,9 @@

    4. Set a password for the current user by ```passwd```, remember this password you will need it later

    5. Start SSH server inside android by running, do not close the app after running the command
    ```
    sshd
    ```
    5. Start SSH server inside android by running ```sshd```, do not close/exit the app after running the command

    6. On the pc terminal run the following, dont use root@ as prefix to the ip address
    6. On the pc terminal run the following, dont use ```root@``` as prefix to the ip address
    ```
    ssh <ip address of android device> -p 8022
    ```
  15. @raveenb raveenb renamed this gist Oct 23, 2019. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  16. @raveenb raveenb revised this gist Oct 23, 2019. 1 changed file with 15 additions and 8 deletions.
    23 changes: 15 additions & 8 deletions android.md
    Original file line number Diff line number Diff line change
    @@ -2,26 +2,33 @@
    ```
    adb install ~/Downloads/Termux_v0.73_apkpure.com.apk
    ```
    1. Then run the app inside the android device
    1. Run the following commands inside the app, choose default option when asked question, just hit enter

    2. Then run the app inside the android device, locate and tap on it

    3. Run the following commands inside the app, use the on device keyboard, (choose default option when asked question, just hit enter)
    ```
    pkg install root-repo
    pkg upgrade
    pkg install openssh
    ```
    1. Set a password for the current user by ```passwd```, remember this password you will need it later
    1. Start SSH server inside android by running, do not close the app after running the command

    4. Set a password for the current user by ```passwd```, remember this password you will need it later

    5. Start SSH server inside android by running, do not close the app after running the command
    ```
    sshd
    ```
    1. On the pc terminal run the following, dont use root@ as prefix to the ip address

    6. On the pc terminal run the following, dont use root@ as prefix to the ip address
    ```
    ssh <ip address of android device> -p 8022
    ```
    1. This will drop you into a shell where you can do further installs using ```pkg install <name>```
    1. If for some odd reason you are getting Host key verification failed error, run the following first

    7. This will drop you into a shell where you can do further installs using ```pkg install <name>```

    8. If for some odd reason you are getting Host key verification failed error, run the following first
    ```
    ssh-keygen -R <ip address of android device>
    ```
    10. If it still gives you trouble edit ```~/.ssh/known_hosts```, locate the line(s) with the ip address and delete it and
    If it still gives you trouble edit ```~/.ssh/known_hosts```, locate the line(s) with the ip address and delete it and
    then connect again
  17. @raveenb raveenb revised this gist Oct 23, 2019. 1 changed file with 7 additions and 7 deletions.
    14 changes: 7 additions & 7 deletions android.md
    Original file line number Diff line number Diff line change
    @@ -2,24 +2,24 @@
    ```
    adb install ~/Downloads/Termux_v0.73_apkpure.com.apk
    ```
    3. Then run the app inside the android device
    4. Run the following commands inside the app, choose default option when asked question, just hit enter
    1. Then run the app inside the android device
    1. Run the following commands inside the app, choose default option when asked question, just hit enter
    ```
    pkg install root-repo
    pkg upgrade
    pkg install openssh
    ```
    5. Set a password for the current user by ```passwd```, remember this password you will need it later
    6. Start SSH server inside android by running, do not close the app after running the command
    1. Set a password for the current user by ```passwd```, remember this password you will need it later
    1. Start SSH server inside android by running, do not close the app after running the command
    ```
    sshd
    ```
    7. On the pc terminal run the following, dont use root@ as prefix to the ip address
    1. On the pc terminal run the following, dont use root@ as prefix to the ip address
    ```
    ssh <ip address of android device> -p 8022
    ```
    8. This will drop you into a shell where you can do further installs using ```pkg install <name>```
    9. If for some odd reason you are getting Host key verification failed error, run the following first
    1. This will drop you into a shell where you can do further installs using ```pkg install <name>```
    1. If for some odd reason you are getting Host key verification failed error, run the following first
    ```
    ssh-keygen -R <ip address of android device>
    ```
  18. @raveenb raveenb revised this gist Oct 23, 2019. 1 changed file with 11 additions and 7 deletions.
    18 changes: 11 additions & 7 deletions android.md
    Original file line number Diff line number Diff line change
    @@ -2,22 +2,26 @@
    ```
    adb install ~/Downloads/Termux_v0.73_apkpure.com.apk
    ```

    3. Then run the app inside the android device
    4. Run the following commands inside the app
    4. Run the following commands inside the app, choose default option when asked question, just hit enter
    ```
    pkg install root-repo
    pkg upgrade
    pkg install openssh
    ```
    5. Set a password for the current user by running, remember this password you will need it later
    passwd
    6. Start SSH server inside android by running
    5. Set a password for the current user by ```passwd```, remember this password you will need it later
    6. Start SSH server inside android by running, do not close the app after running the command
    ```
    sshd
    ```
    7. On the pc terminal run the following, dont use root@ as prefix to the ip address
    ```
    ssh <ip address of android device> -p 8022
    8. This will drop you into a shell where you can do further installs using pkg install <name>
    ```
    8. This will drop you into a shell where you can do further installs using ```pkg install <name>```
    9. If for some odd reason you are getting Host key verification failed error, run the following first
    ```
    ssh-keygen -R <ip address of android device>
    10. If it still gives you trouble edit ~/.ssh/known_hosts, locate the line(s) with the ip address and delete it and
    ```
    10. If it still gives you trouble edit ```~/.ssh/known_hosts```, locate the line(s) with the ip address and delete it and
    then connect again
  19. @raveenb raveenb revised this gist Oct 23, 2019. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions android.md
    Original file line number Diff line number Diff line change
    @@ -1,15 +1,15 @@
    1. Install Android App Termux from APKPure or AppStore.
    2. If the app exists, just delete and re-install it, can be done quickly using
    1. Install Android App Termux from APKPure or AppStore. If the app exists, just delete and re-install it, can be done quickly using
    ```
    adb install ~/Downloads/Termux_v0.73_apkpure.com.apk
    ```

    3. Then run the app inside the android device
    4. Run the following commands inside the app

    ```
    pkg install root-repo
    pkg upgrade
    pkg install openssh
    ```
    5. Set a password for the current user by running, remember this password you will need it later
    passwd
    6. Start SSH server inside android by running
  20. @raveenb raveenb revised this gist Oct 23, 2019. 1 changed file with 6 additions and 2 deletions.
    8 changes: 6 additions & 2 deletions android.md
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,12 @@
    1. Install Android App Termux from APKPure or AppStore.
    2. If the app exists, just delete and re-install it, can be done quickly using
    ```adb install ~/Downloads/Termux_v0.73_apkpure.com.apk```
    2. If the app exists, just delete and re-install it, can be done quickly using
    ```
    adb install ~/Downloads/Termux_v0.73_apkpure.com.apk
    ```

    3. Then run the app inside the android device
    4. Run the following commands inside the app

    pkg install root-repo
    pkg upgrade
    pkg install openssh
  21. @raveenb raveenb revised this gist Oct 23, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion android.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    1. Install Android App Termux from APKPure or AppStore.
    2. If the app exists, just delete and re-install it, can be done quickly using
    adb install ~/Downloads/Termux_v0.73_apkpure.com.apk
    ```adb install ~/Downloads/Termux_v0.73_apkpure.com.apk```
    3. Then run the app inside the android device
    4. Run the following commands inside the app
    pkg install root-repo
  22. @raveenb raveenb created this gist Oct 23, 2019.
    19 changes: 19 additions & 0 deletions android.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    1. Install Android App Termux from APKPure or AppStore.
    2. If the app exists, just delete and re-install it, can be done quickly using
    adb install ~/Downloads/Termux_v0.73_apkpure.com.apk
    3. Then run the app inside the android device
    4. Run the following commands inside the app
    pkg install root-repo
    pkg upgrade
    pkg install openssh
    5. Set a password for the current user by running, remember this password you will need it later
    passwd
    6. Start SSH server inside android by running
    sshd
    7. On the pc terminal run the following, dont use root@ as prefix to the ip address
    ssh <ip address of android device> -p 8022
    8. This will drop you into a shell where you can do further installs using pkg install <name>
    9. If for some odd reason you are getting Host key verification failed error, run the following first
    ssh-keygen -R <ip address of android device>
    10. If it still gives you trouble edit ~/.ssh/known_hosts, locate the line(s) with the ip address and delete it and
    then connect again