Android设备adb始终在linux / mac上未经授权 [英] Android device adb always unauthorized on linux/Mac

查看:509
本文介绍了Android设备adb始终在linux / mac上未经授权的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不得不处理几次,每次我忘记原因是什么,直到我深入研究。因此,症状如下:

I've had to deal with this one a few times and every time I forget what the cause is until I dig deep. So here are the symptoms:


  • 每次重新连接/重新启动设备时,即使可以 swear 您上次选中 Always 复选框。

  • adb shell 为您提供了下面的内容

  • adb设备为您提供下面的其他内容

  • 您在进入时无法通过adb连接恢复

  • 设备未经授权并且插入设备不会显示授权对话框

  • Every time you reconnect/reboot the device you get the authorization dialog even though you could swear you checked the Always checkbox the last time.
  • adb shell gives you the blurb below
  • adb devices gives you the other blurb below
  • You cannot connect via adb while in recovery
  • Device is unauthorized and plugging it in won't display the authorization dialog

adb shell blurb

user@PC:~$ adb shell
error: device unauthorized.
This adbd's $ADB_VENDOR_KEYS is not set; try 'adb kill-server' if that seems wrong.
Otherwise check for a confirmation dialog on your device.

adb设备 模糊

user@PC:~$ adb devices
List of devices attached
C4F124F1B9A98AE unauthorized

您的udev规则已经到位,并且从 lsusb 存在于您的 /etc/udev/rules.d/51-android.rules (或redhat等效项,如果不同)中

Your udev rules are in place and the codes outputted from lsusb are present in your /etc/udev/rules.d/51-android.rules (or the redhat equivalent, if different)

发生了什么事?

推荐答案

对我来说,问题出在下面:

Well, for me, the issue has been what you see below:

user@PC:~$ ls -al ~/.android/
total 20
drwxrwxr-x  3 user    user 4096 Jun  7 15:46 .
drwxr-xr-x 30 user    user 4096 Sep 19 11:30 ..
-rw-------  1 root    root 1704 Jun  7 15:46 adbkey
-rw-r--r--  1 root    root  710 Jun  7 15:46 adbkey.pub
drwxrwxr-x  2 user    user 4096 Jun  7 15:42 cache

注意我的 adbkey 和匹配的公钥是如何由root拥有的?
我第一次在此计算机上运行 adb任何内容是root用户。
修复很容易,您可能已经知道: sudo chown user:user〜/ .android / adbkey *

Notice how my adbkey and the matching public key are owned by root? The first time I've ran adb anything on this machine has been as root. The fix is easy and you probably already know it: sudo chown user:user ~/.android/adbkey*

这篇关于Android设备adb始终在linux / mac上未经授权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆