[Android Software Development] egingell:
Make ADB work for all users - Jelly Bean 4.2.2 (Updated 07/15/13 00:35 MST)

With Android 4.2.2, ADB now requires RSA keys. This poses a problem when attempting to connect to the device's ADB server from the device itself and the device won't ask for authorization unless it's connected via USB. Well, there's hope, yet.

For the following, I'm assuming you used my method for adding init.d support to your device.

Use these scripts at your own risk. I provide no warranties or guarantees.

Add the following script to /system/bin/debuggerd. If you use an alternate method, please note that it must be executed by the debugger daemon. You must do this first or you'll have to manually restart the debugger daemon after editing this file and executing the run-once script (next step), so edit this file first and save it. :)

if [ ! -e "/.android" ]; then
busybox mount -o rw,remount /
mkdir /.android
mount -o bind /data/.android /.android
busybox mount -o ro,remount /
fi

Then run this script once from the device (not over ADB on your PC).

[COLOR="Green"]#!/system/bin/sh[/COLOR]
HOME=/data
adb kill-server
adb start-server
stop adbd
cat /data/.android/adbkey.pub >> /data/misc/adb/adb_keys
echo "" >> /data/misc/adb/adb_keys # Add a blank line at the end of the file
start adbd
HOME=/
adb kill-server
stop debuggerd
start debuggerd

Notes:

You can also find the abdkey.pub file on your Windows' PC here, C:\Users\<user name>\.android\adbkey.pub. Copy it to your device by whatever means necessary, then append it to /data/misc/adb/adb_keys and you won't need to initially use the USB to allow the PC connection. Not really necessary unless your PC has no USB or you've broken your USB cable.

This may have inadvertently corrected the mounting issue introduced in Jelly Bean 4.2.2.

You can also allow other Android 4.2.2 devices, but it requires ADB version 1.0.31 and for you to manually append the contents of /data/.android/adbkey.pub from device A (the one you want to use to ADB on) to /data/misc/adb/adb_keys on device B (the target device).

Don't delete /data/.android

This won't fix apps. Just allow you to use ADB to connect to your device from itself.

Tested on my SGS4. No reason it won't work on other devices.

If you already have a /data/.android directory, you may not need to do this. On my SGS4, HOME defaults to "/" which the ADB daemon can't write to, so it can't make the RSA key.

The run-once script temporarily changes HOME to "/data", a writable directory, so the ADB daemon can write the RSA key then it append it to the allowed clients file then restarts the debugger daemon thus binding /data/.android to the /.android directory allowing all Linux users ADB access to the device.

Reassigning HOME to a new value on one user only changes its value for that user which is why I'm binding /data/.android to /.android.

# Example
shell@android:/ $ echo $HOME
/
shell@android:/ $ HOME=/data
shell@android:/ $ echo $HOME
/data
shell@android:/ $ su 1000
system@android:/ $ echo $HOME
/

Alternatively (much easier):

Make the .android folder in /data (mkdir /data/.android).

Add the script, the first code block in this post, to your debuggerd file or an init.d script.

Restart the debugger (stop debuggerd; start debuggerd) or reboot the phone.

Restart ADB (stop adbd; start adbd).

Copy the newly created public key to the allowed clients (cat /data/.android/adbkey.pub >> /data/misc/adb/adb_keys; echo "" >> /data/misc/adb/adb_keys).

Restart the ADB server (adb kill-server; adb start-server).