Project

General

Profile

ADB » History » Version 9

Denis 'GNUtoo' Carikli, 11/09/2020 07:00 PM
import permissions revoking from BackupTheEFS

1 1 Paul Kocialkowski
h1. ADB
2
3 9 Denis 'GNUtoo' Carikli
{{toc}}
4
5 1 Paul Kocialkowski
h2. Installing ADB
6
7 8 Denis 'GNUtoo' Carikli
See the [[ToolsInstallation]] page for how to install adb.
8 1 Paul Kocialkowski
9 5 Wolfgang Wiedmeyer
h2. Enabling ADB
10
11
In the settings, open *Developer options*. In the Debugging section, enable *Android debugging*.
12
13 1 Paul Kocialkowski
h2. Authorizing the device
14
15
In order to allow your host computer to access ADB on the device, it must be allowed on the device. A window should pop up when connecting USB, asking whether to allow USB debugging. 
16 2 Paul Kocialkowski
*Note: when booting with USB plugged in, the window doesn't pop up and you have to disconnect and reconnect the USB cable to see it happen.*
17 1 Paul Kocialkowski
18
h2. Accessing root shell
19
20
Once allowed, you can access the device shell using:
21 4 Wolfgang Wiedmeyer
22 1 Paul Kocialkowski
<pre>
23
adb shell
24
</pre>
25
26 5 Wolfgang Wiedmeyer
The shell is running as an unprivileged user.
27 1 Paul Kocialkowski
28 6 Denis 'GNUtoo' Carikli
To allow root access, open the *Developer options* in the settings. There, press *Root access*. In the pop-up menu, select either *ADB only* or *Apps and ADB*. A window with "Allow root access?" might pop up and explains the security tradeoffs of enabling root access. After reading the text, select OK to enable root access.
29 5 Wolfgang Wiedmeyer
30
To finally gain root access, use:
31
32 1 Paul Kocialkowski
<pre>
33
adb root
34
</pre>
35
36 4 Wolfgang Wiedmeyer
The following shells will then be run as root.
37
38 1 Paul Kocialkowski
h2. Modifying the system partition
39 4 Wolfgang Wiedmeyer
40 5 Wolfgang Wiedmeyer
Replicant is installed on the system partition. By default with most devices, this partition is mounted as read-only and can't be modified.
41 4 Wolfgang Wiedmeyer
You can mount the partition as writable filesystem using:
42
43
<pre>
44
adb remount
45
</pre>
46
47
Files under @/system/@ can now be edited.
48 9 Denis 'GNUtoo' Carikli
49
50
h2. Revoking a computer's permissions
51
52
Sometimes, you need to use @Always allow from this computer@ to give a computer more permanent USB debugging permissions. This for instance the case in the [[BackupTheEFS]] instructions.
53
54
However once you are done with what needs such permissions, you might want to revoke the permissions if you don't need anymore, to increase security.
55
56
This control is located at @Settings@ > @Developer options@ > @Revoke USB debugging authorizations@.