19

I have rooted my device HTC Evo Design 4G and I try to adb pull /data data and it says "0 files pull 0 file skipped"

I was able to pull /System/build.prop. How can I pull root folder.

Thank you iua

  • 1
    Did you run adb root first? – onik Jul 4 '14 at 6:35
  • Yes, but adb root was not success. No permission. But I could adb shell su. It gives #. – user3734225 Jul 4 '14 at 7:13
20

Files and directories below /data/data are protected from the "average user", so you cannot simply "pull" them unless the ADB daemon is running in root mode. Other than the file you were referring to (/system/buildprop is at least readable by all apps), folders below /data/data are "invisible" (except for root), so they cannot even be read.

To be able to use adb pull on them, you need to make your ADB daemon run in root mode first. Depending on the device, a simple adb root command might do that – but most devices will refuse to do. In those cases, you can use chainfire's adbd insecure: Install this app on your device, start it there, and manually switch to "insecure" mode. Now the pull should succeed.

Remark: It's called "insecure" because running adbd as root gives everybody with a computer and an USB cable access to everything on your device. Just in case you wonder.

  • Thamk you! Apart from the chainfire adbd insecure, Can I set ro.secure flag in build property? Can I use adb shell setprop ro.secure 0? – user3734225 Jul 5 '14 at 1:20
  • I haven't ever tried that, nor do I know exactly what that flag is for – so I cannot tell. (Btw: if you found the answer useful, you're welcome to "upvote" it (the SE way to say "thanks") – or "accept" it when it solved our issue ;) – Izzy Jul 5 '14 at 18:05
  • 1
    adbd insecure work for me :) – user3734225 Jul 6 '14 at 1:27
6

If your phone's rooted, there are three ways to go around this. The first one is to use ADBD insecure.

The other one is to move it to another folder with root and then pull it from there:

$ adb shell

shell@android:/ $ su
root@android:/ # mkdir /sdcard/data
root@android:/ # cp /data/data/* /sdcard/data
root@android:/ # exit
shell@android:/ $ exit 

$ adb pull /sdcard/data .
$ adb shell

shell@android:/ $ rm -r /sdcard/data/
shell@android:/ $ exit

I think you can build a script such as:

echo 'echo "mkdir /sdcard/data; cp $1/* /sdcard/data; exit" | su; exit' | adb shell
adb pull /sdcard/data .
echo 'rm -r /sdcard/data; exit' | adb shell

and save it somewhere.

Finally, the third option is chmod -R 1777 /data/data, but this is much more unsafe, so it's highly discouraged.

  • May I ask what $1/* refers to? Is it the /data/data directory? – Emen Oct 7 '16 at 9:37
  • vonderful answer – Dan Bradbury Nov 25 '17 at 1:22
5

You cannot pull data folder directly since adb doesn't have file listing access to it. If you want to pull the /data folder you can do it via recovery ([Custom recovery, CWM/TWRP] run adb while device is in recovery mode, hopefully a custom recovery). Or as root, copy /data to another directory (sdcard) and pull it from there.

  • Thank you. But I was able to pull build.prop file in /System folder. adb shell su and then I can list files in root folder. I read in a Google search setting ro.secure build property to 0 will help pull /data. Is this true? If so is there a way to do it? – user3734225 Jul 4 '14 at 7:23
  • You can pull build.prop because /system has listing permission. You can change ro.secure=0 in your boot.img, but that is a really complex step. It would be easier to just install a custom recovery and do it from there. – Hiemanshu Sharma Jul 4 '14 at 7:28
  • Thank you very much! My primary purpose of the effort is implementing a forensic related application as a university final year project. I am really afraid, installing custom recovery will wipe out evidences from the device. Do you have any idea about the subject. – user3734225 Jul 4 '14 at 7:38
  • Adding to my previous comment - What is the use of adb shell setprop? Can't I use it in this case? – user3734225 Jul 4 '14 at 7:57
  • 1
    A forensic recovery program that relies on the phone being rooted and having debugging turned on doesn't sound very useful. – Dan Hulme Jul 4 '14 at 8:07
1

PART I: Getting all the files ready for an ADB PULL

This is what worked for me: * Make sure you're using the latest ADB version.

  • Start the ADB session:

'infocus$ adb shell'

  • Get SU rights once in the ADB session all you have to do it's type "su" like so:

'shell@m1:/ $ su'

Then you'll notice that the "$" becomes "#", like so:

'root@m1:/ #'

-The hash let's you know you're on SU mode.

  • Make a folder on the /sdcard of the device

'root@m1:/ # mkdir /sdcard/data/'

*head to the root of the file you want to copy -For me for example I wanted to make a backup/copy of my apps and store it on my computer so:

'root@m1:/data/app #'

  • An example of what I get if I "ls" that folder:

'root@m1:/data/app # ls
com.abtnprojects.ambatana-1
com.acr.rootfilemanager-1
com.amazon.kindle-1
com.android.chrome-1
com.android.mms-1
com.android.vending-2'

  • In order to copy recursively with the ADB "cp" command, use the option "-R" and since I wanted to copy everything in it I used the wildcard "*" like so:

'root@m1:/data/app # cp -R */ /sdcard/data/ '

  • Once you press enter, if the file is fairly large it will obviously take a while to copy the files, so the cursor will idly blink for a bit, it will look like if not doing anything, BUT IT IS! it's copying the files, so don't panic! and don't stop the process!!! -If you want just open another ADB shell session and head to the folder where you're transferring the files and do an "ls" check and you should see that the empty folder is now getting populated with the files. Once the transfer is done, you'll get your shell back.

  • Head to the "sdcard/data" and make sure everything was copied "ls":

'root@m1:/sdcard/data # ls
com.abtnprojects.ambatana-1
com.acr.rootfilemanager-1
com.amazon.kindle-1
com.android.chrome-1
com.android.mms-1'

PART II: The ADB PULL

  • By this point if you haven't created a folder on the target machine, do so. I conveniently created a folder called "apps"

  • Now, lets do the elusive recursive ADB PULL of all the files at once: -Make sure that you are logged out of the ADB session, since we're been on SU mode we'll need to exit twice:

'root@m1:/sdcard/data # exit'
'shell@m1:/ $ exit'

  • From a normal shell session run the "adb pull", you don't have to use the "-a" option, I personally use it to keep the integrity of the files as much as possible. - run the command:

'AtomicusZro$ adb pull -a /sdcard/data/ apps/'

You should see something like this:

'[ 69%] /sdcard/data/com.google.android.gms-1/base.apk: 74%'

Once it's done:

'/sdcard/data/: 296 files pulled. 5.1 MB/s (1193942288 bytes in 221.352s)'

And Voila!

Side Notes:
.Don't know if matters but I use a Mac.
.If while on the ADB session you can't get "su privileges" either:
1st: You probably need to give ADB root access
2nd: "super user" it's not installed correctly
.Double check your commands

Good Luck.-

  • Don't I need to be rooted for that? – neverMind9 Jun 1 '18 at 13:35
0

working on my android 7.1 device. steps to get it working:

  1. download the adbd insecure version by leroy at https://nofile.io/f/86605d8qsJs/adbd-Insecure-v2.00.apk
  2. install in your phone.
  3. run adb shell in your adb directory
  4. type "su" so u can get the "#"
  5. type "setenforce 0"
  6. enable insecure adbd. usb debugging turns off
  7. turn usb debugging on and off from developer options
  8. turn insecure adbd off and on again.

you can now adb pull into your pc.

Hope this helps


Haris

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.