Why am I getting Permission Denied when trying to push a Sqlite file to my rooted Android device?

17,055

Solution 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

Solution 2

'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.

Solution 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/
Share:
17,055
User1
Author by

User1

A Desktop, Mobile and Web Developer from the United Kingdom

Updated on June 06, 2022

Comments

  • User1
    User1 almost 2 years

    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?