Installing ADB

See the ToolsInstallation page for how to install adb.

Enabling ADB

In the settings, open Developer options. In the Debugging section, enable Android debugging.

Authorizing the device

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.
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.

Accessing root shell

Once allowed, you can access the device shell using:

adb shell

The shell is running as an unprivileged user.

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.

To finally gain root access, use:

adb root

The following shells will then be run as root.

Modifying the system partition

Replicant is installed on the system partition. By default with most devices, this partition is mounted as read-only and can't be modified.
You can mount the partition as writable filesystem using:

adb remount

Files under /system/ can now be edited.

Revoking all computer's USB debugging permissions

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.

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.

To do that you can select Revoke USB debugging authorizations in Developer options in the Settings (Settings > Developer options > Revoke USB debugging authorizations).