adb 返回Permission denied分析及解决

文章目录[隐藏]

命令:

adb shell ip addr show wlan0

返回错误提示:

ifconfig: ioctl 8927: Permission denied

原因:
系统:安卓 Android 10
在安卓10下我们要调用以下命令:

./adb -s $device shell ip addr show wlan0 | grep -e wlan0$ | cut -d " " -f 6 | cut -d/ -f 1

例如:

adb shell ip addr show wlan0

而不在是:

ifconfig: ioctl 8927: Permission denied

以下是安卓10下的命令格式:

./adb -s $device shell ifconfig wlan0 | grep 'inet addr' | cut -d: -f2 | awk '{print $1}'

二者返回值的不同

  1. adb shell ifconfig wlan0

返回:

wlan0     Link encap:UNSPEC    Driver bcmsdh_sdmmc
          inet addr:192.168.1.22  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: 2409:8a0c:662e:1f75:b5b4:855:b745:7db7/64 Scope: Global
          inet6 addr: 2409:8a0c:662e:1f75:fe3f:7cff:fea4:5be4/64 Scope: Global
          inet6 addr: fe80::fe3f:5cff:fea4:5be4/64 Scope: Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:535283 errors:0 dropped:0 overruns:0 frame:0
          TX packets:310385 errors:0 dropped:1599 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:502291413 TX bytes:46593720

安卓 Android 10

adb shell ip addr show wlan0

返回:

 wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 88:40:3b:1f:43:56 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.3/24 brd 192.168.1.255 scope global wlan0
       valid_lft forever preferred_lft forever
    inet6 2409:8a0c:662e:1f74:a5c6:4f90:83bc:b957/64 scope global temporary dynamic
       valid_lft 7141sec preferred_lft 3541sec
    inet6 2419:8a0c:662e:1f74:5b58:997:7b4d:a61b/64 scope global dynamic mngtmpaddr stable-privacy
       valid_lft 7114sec preferred_lft 3544sec
    inet6 fe80::3611:2cfa:6b3a:1a72/64 scope link stable-privacy
       valid_lft forever preferred_lft forever

发布日期:

所属分类: 网游单机 标签:  


没有相关文章!