Project

General

Profile

Actions

SSH » History » Revision 8

« Previous | Revision 8/11 (diff) | Next »
Denis 'GNUtoo' Carikli, 04/25/2019 09:23 PM
generating keys don't fail anymore on Replicant 6.0 0003


SSH

Server

This tutorial was tested on Replicant 6.0, it might or might not work on older Replicant versions.

This tutorial assumes that:
  • You already setup adb and gave it root access
  • You already know how to use OpenSSH.
  • You already generated some SSH keys on your computer.

First, connect your smartphone or tablet to your computer trough USB, and make sure that ADB is already setup. If it is not, you can follow the explanations on how to setup ADB.

Then on your computer, make sure to give adb root permissions:

$ adb root

OpenSSH requires some host keys to work, generate them on your smartphone/tablet with:

$ adb shell "/system/bin/ssh-keygen -A" 

OpenSSH also needs a configuration file in /data/ssh/sshd_config, and by default the /data/ssh/sshd_config doesn't exist. Since we have an example configuration file in /etc/ssh/sshd_config, we can use it.

First copy the smartphone/tablet's /etc/ssh/sshd_config to your computer.

#cp /etc/ssh/sshd_config /data/ssh/sshd_config

Then, to permit accessing the smartphone/tablet with your SSH key, you need to copy your public key to the smartphone/tablet. This can be done with:

$ adb push ~/.ssh/id_rsa.pub /data/ssh/authorized_keys

First get a root shell on the smartphone/tablet with:

$ adb root
$ adb shell

Then you can start OpenSSH with:
root@i9300:/ # /system/bin/sshd

Note that OpenSSH won't be started automatically at boot, so after rebooting the smartphone/tablet, it will need to be started again manually.

You should then be able to ssh into the smartphone/tablet. For instance, if you connect to it trough WiFi and that it's IP address is 192.168.43.1, you can do it this way:

$ ssh root@192.168.43.1

Updated by Denis 'GNUtoo' Carikli over 5 years ago · 8 revisions

Also available in: PDF HTML TXT