4

So I have a local Sqlite file I am trying to push to my Rooted Android (Nexus 7 2013) device. Which I have confirmed is Rooted by tying adb shell, su and seeing the # displayed instead of $

I am trying to run the following command:

adb push D:\tfs\MyApp\MyDatabase.db3 /data/data/MyApp/files/MyDatabase.db3

But I keep getting

Failed to copy ...MyApp.. to ...MyApp...: Permission denied

I have searched the internet and found answers here and here and have come up with the following:

adb shell su -c "mount -o rw,remount /data"
adb shell su -c "chmod 777 /data"

But even after running these two above commands and running my Push Command I am still getting Permission Denied.

What am I doing wrong?

Community
  • 1
  • 1
JKennedy
  • 18,150
  • 17
  • 114
  • 198

5 Answers5

21

'adb push' cannot push to data/data/ directory. However, you can do it by using a transfer station like this:

adb push D:\tfs\MyApp\MyDatabase.db3 ~/sdcard/MyDatabase.db3

adb shell

su

mv /sdcard/MyDatabase.db3 /data/data/MyApp/files/MyDatabase.db3

It works for me,good luck to you.

banking
  • 480
  • 2
  • 9
3

To push an APK file Eg:"MyApp" to /data/local/tmp/ from my local C:/Apps

adb push C:/Apps/MyApp /data/local/tmp/ is giving Permission Denied error

Steps to make this work (issue these commands in an order)

  1. adb shell
  2. su
  3. chmod 777 /data/local/tmp/
  4. exit
  5. chmod 777 /data/local/tmp/
  6. exit

Now if i give adb push, it worked

adb push C:/Apps/MyApp /data/local/tmp/
2

Simple solution:

  • Instead of: .\adb.exe push c:/files-to-push.zip /mnt/sdcard/Download
  • I used: .\adb.exe push c:/files-to-push.zip /sdcard/Download

The problem I had

After going to adb folder(in my case c:/adb)

I connected with: .\adb.exe connect 127.0.0.1:58526

And then I tried to push this zip file c:/Games/pokemon.zip by running:

.\adb.exe push c:/Games/pokemon.zip /mnt/sdcard/Download

I got this error:

adb: error: stat failed when trying to push to /mnt/sdcard/Download: Permission denied

Explaining my solution:

I was trying to push files to a path that does not exist...

In my case I tried to push to /mnt/sdcard/Download

Then after running adb shell I got access to console

Finally just typed ls to check which folder I had there

In my case I saw there was no /mnt

So after that I tried to ls /sdcard and saw Download folder there...

1

Ok so heres my solution.

My phone was already Rooted but for some reason this isnt enough to do anything you want.

I had to go and download the apk onto my device named adbd insecure mentioned here which you can download on that thread or from the google play store. I then had to open the App on my device and click "Enable Insecure adbd" and I also clicked "Enable at boot"

After this running my normal command:

adb push D:\tfs\MyApp\MyDatabase.db3 /data/data/MyApp/files/MyDatabase.db3

worked

JKennedy
  • 18,150
  • 17
  • 114
  • 198
0

Run the commands below:

adb root

or

adb wait-for-device root && adb remount
YesThatIsMyName
  • 1,585
  • 3
  • 23
  • 30