# 解决 'adb root' 时提示 'adbd cannot run as root in production builds'

1.在手机上，装上安卓终端软件，直接在本地系统上root是可以的

https://github.com/topjohnwu/Magisk/issues/425

By design adb root command works in development builds only (i.e. eng and userdebug which have ro.debuggable=1 by default). So to enable the adb root command on your otherwise rooteddevice just add the ro.debuggable=1 line to one of the following files:

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

If you want adb shell to start as root by default - then add ro.secure=0 as well.

Alternatively you could use modified adbd binary (which does not check for ro.debuggable)

#if defined(ALLOW_ADBD_ROOT)
// The properties that affect adb root and adb unroot are ro.secure and
// ro.debuggable. In this context the names don't make the expected behavior
// particularly obvious.
//
// ro.debuggable:
//   Allowed to become root, but not necessarily the default. Set to 1 on
//   eng and userdebug builds.
//
// ro.secure:
//   Drop privileges by default. Set to 1 on userdebug and user builds.

Launch a script as root through ADB

#执行多条命令
adb shell "su -c '命令1; 命令2'"

#分行执行多条命令
命令1;
命令2
'"

#例子
'"