If you are trying to access your android devices shell using adb on a new Ubuntu machine, there are higher chances that your may seen an error like below,
$ adb devices
List of devices attached
* daemon not running; starting now at tcp:5037
* daemon started successfully
B2NGAA8831702707 no permissions (user in plugdev group; are your udev rules wrong?); see [http://developer.android.com/tools/device.html]
OR
error: insufficient permissions for device: user in plugdev group; are your udev rules wrong?
See [http://developer.android.com/tools/device.html] for more information
This error is because, your Ubuntu machine user is not able to access adb shell due to some permission restrictions. As we have observed, there are 3 possible solutions for resolving this issue, either one of these should work for you.
Solution 1
Know the USB Vendor Id and Product Id of your android device using lsusb command as,
$ lsusb
Bus 001 Device 019: ID 2e04:c008
As seen above, For Our mobile idVendor is 2e04 and idProduct is c008, add this details to udev rule as, [ Replace idVendor and idProduct as per your device ]
$ sudo vim /etc/udev/rules.d/51-android.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="2e04", ATTR{idProduct}=="c008", MODE="0666", GROUP="plugdev"
$ sudo udevadm control --reload-rules
$ adb kill-server
Now, disconnect the USB cable and reconnect it and check adb devices is able to show your device.
$ adb devices
Solution 2
In our case, if we use with sudo permissions i.e. “sudo adb devices” was working fine and we could access adb, but we were getting above errors with normal user. In our case, rest of 2 solutions didn’t worked because “our mobile was connected to laptop in “USB Tethering Mode” from Hotspot and Tethering settings options.
Till you access adb shell, switch USB to “File Transfer” mode
and try again, as,
$ adb kill-server
$ adb devices
Solution 3
As mentioned in https://developer.android.com/studio/run/device Make sure that you are in the plugdev group. Add your user to playdev group as below,
$ sudo usermod -aG plugdev "your username"
$ adb kill-server
$ adb devices
Solution 4
Even by followed all 3 options and still it didn’t worked and got same issue of “no permissions (user in plugdev group; are your udev rules wrong?)” ,
there is one more thing, we can do (and same worked for us), Enable “Developer Options” and then turn OFF and turn ON “USB Debugging” option, try and see if it worked.
If not, scroll below in same “Developer Options” and click on “Default USB Configuration” and from there choose “File Transfer” instead of “No data transfer”
and now it worked for us.
Thanks this helped me after losing more than an hour on this thing.
Actually i tried second solution.It’s work perfectly .Thanks Friend
yes its working on mint linux with realme c33 device. thank you
Thank You!!! You saved me brooooo