SSH » History » Version 8
Denis 'GNUtoo' Carikli, 04/25/2019 09:23 PM
generating keys don't fail anymore on Replicant 6.0 0003
1 | 1 | Denis 'GNUtoo' Carikli | h1. SSH |
---|---|---|---|
2 | 2 | Denis 'GNUtoo' Carikli | |
3 | 1 | Denis 'GNUtoo' Carikli | h2. Server |
4 | |||
5 | This tutorial was tested on Replicant 6.0, it might or might not work on older Replicant versions. |
||
6 | |||
7 | 5 | Denis 'GNUtoo' Carikli | This tutorial assumes that: |
8 | 7 | Denis 'GNUtoo' Carikli | * You already setup adb and gave it root access |
9 | 5 | Denis 'GNUtoo' Carikli | * You already know how to use OpenSSH. |
10 | * You already generated some SSH keys on your computer. |
||
11 | 3 | Denis 'GNUtoo' Carikli | |
12 | 1 | Denis 'GNUtoo' Carikli | 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 [[ADB|explanations on how to setup ADB]]. |
13 | |||
14 | Then on your computer, make sure to give adb root permissions: |
||
15 | <pre> |
||
16 | $ adb root |
||
17 | </pre> |
||
18 | |||
19 | 3 | Denis 'GNUtoo' Carikli | OpenSSH requires some host keys to work, generate them on your smartphone/tablet with: |
20 | 1 | Denis 'GNUtoo' Carikli | <pre> |
21 | $ adb shell "/system/bin/ssh-keygen -A" |
||
22 | </pre> |
||
23 | |||
24 | 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. |
||
25 | |||
26 | 3 | Denis 'GNUtoo' Carikli | First copy the smartphone/tablet's /etc/ssh/sshd_config to your computer. |
27 | 1 | Denis 'GNUtoo' Carikli | <pre> |
28 | 8 | Denis 'GNUtoo' Carikli | #cp /etc/ssh/sshd_config /data/ssh/sshd_config |
29 | 1 | Denis 'GNUtoo' Carikli | </pre> |
30 | |||
31 | 3 | Denis 'GNUtoo' Carikli | 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: |
32 | 1 | Denis 'GNUtoo' Carikli | <pre> |
33 | $ adb push ~/.ssh/id_rsa.pub /data/ssh/authorized_keys |
||
34 | </pre> |
||
35 | |||
36 | 7 | Denis 'GNUtoo' Carikli | First get a root shell on the smartphone/tablet with: |
37 | 1 | Denis 'GNUtoo' Carikli | <pre> |
38 | $ adb root |
||
39 | 7 | Denis 'GNUtoo' Carikli | $ adb shell |
40 | </pre> |
||
41 | Then you can start OpenSSH with: |
||
42 | <pre> |
||
43 | root@i9300:/ # /system/bin/sshd |
||
44 | 1 | Denis 'GNUtoo' Carikli | </pre> |
45 | 3 | Denis 'GNUtoo' Carikli | |
46 | 1 | Denis 'GNUtoo' Carikli | Note that OpenSSH won't be started automatically at boot, so after rebooting the smartphone/tablet, it will need to be started again manually. |
47 | |||
48 | 5 | Denis 'GNUtoo' Carikli | 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: |
49 | 1 | Denis 'GNUtoo' Carikli | <pre> |
50 | $ ssh root@192.168.43.1 |
||
51 | </pre> |