Understanding “adb shell su” and “adb root” Commands

Understanding "adb shell su" and "adb root" Commands

22 April 2024 Stephan Petzl Leave a comment Tech-Help

When working with rooted Android devices, developers often need to execute commands with root permissions. This can be achieved using the “adb shell su” and “adb root” commands. However, there is a distinct difference between these two commands, which can lead to confusion and errors such as “adbd cannot run as root in production builds.”

“adb shell su” vs. “adb root”

The command adb shell su grants you superuser access within the shell environment of your Android device. This is typically used after establishing an ADB shell session and requires user interaction to grant superuser permissions, often through a prompt from apps like SuperSU.

On the other hand, the command adb root restarts the adb daemon with root permissions, allowing you to execute ADB commands as root without entering the shell. This command is mostly available on development builds or devices with unlocked bootloaders. It’s not intended for production builds due to security reasons.

Solving “adbd cannot run as root in production builds” Error

If you encounter this error, it indicates that your device does not allow the adb daemon to run as root due to its production build configuration. However, for users with rooted devices looking to enable adb root, there are a couple of methods to consider:

Modifying Build Properties

One solution is to add the line ro.debuggable=1 to one of the following files on your rooted device:

  • /system/build.prop
  • /system/default.prop
  • /data/local.prop

Additionally, setting ro.secure=0 will make the shell start as root by default. Modifying these properties will require a file editor with root access or a command-line text editor like vi or nano.

Using Modified adbd Binary

An alternative approach is to use a modified adbd binary that does not check for ro.debuggable. This might involve replacing the adbd binary in the boot image, which requires knowledge of de-compiling and re-compiling boot images.

Repeato: Enhancing Your Testing Workflow

While the above solutions can enable root access for ADB commands, it’s important to ensure that your app testing is effective and efficient. This is where Repeato, a no-code test automation tool, comes into play.

Repeato simplifies the creation, execution, and maintenance of automated tests for iOS and Android apps. Its fast editing and test execution capabilities are complemented by the use of computer vision and AI, making it a versatile option for apps built with frameworks like React Native, Flutter, or Unity. Moreover, with ADB on board, Repeato allows you to execute ADB commands via script steps, enhancing your testing process even further.

By seamlessly integrating into your development workflow, Repeato can help address issues related to app testing and automation, ensuring your apps function flawlessly on all devices.


Gaining root access for ADB commands can be an essential part of Android development and testing. By understanding the difference between “adb shell su” and “adb root,” and knowing how to work around the restrictions of production builds, you can take full control of your rooted device for development purposes. Additionally, leveraging a tool like Repeato can significantly improve the reliability and efficiency of your automated testing efforts.

Like this article? there’s more where that came from!