TransWikia.com

adb push ... Permission denied

Android Enthusiasts Asked by yohosuff on December 6, 2021

I am trying to push a file to a directory on a physical android device, but I am running into the following error.

>adb push data.db /data/data/com.me.app/databases
failed to copy 'data.db' to '/data/data/com.me.app/databases/data.db': Permission denied

I believe adb has sufficient privileges.

>adb root
adbd is already running as root

Here are the permission details for the path: /data/data/com.me.app/databases

drwxrwxrwx system   system            2014-01-14 10:31 data
drwxrwxrwx system   system            2015-05-23 16:06 data
drwxrwxrwx u0_a224  u0_a224           2015-05-23 15:26 com.me.app
drwxrwxrwx u0_a224  u0_a224           2015-05-23 15:30 databases

I am not sure what to do here. Perhaps I am going about this the wrong way, but I just want to push the data.db file into the /data/data/com.me.app/databases directory on the device.

Does anyone know what I am doing wrong or what I should consider? Thanks.

3 Answers

I had a variation of this problem so going to leave it here in case someone else googles for it:

./adb push update.zip /sdcard
[  0%] C:/Users/Alex/AppData/Local/Programs/Git/sdcard
adb: error: failed to copy 'update.zip' to 'C:/Users/Alex/AppData/Local/Programs/Git/sdcard':
remote secure_mkdirs failed: No such file or directory
update.zip: 0 files pushed. 41.6 MB/s (131072 bytes in 0.003s)

However in my case the problem was running adb from Git bash Shell (MinGW64). Running it from regular Windows shell worked fine.

Answered by alexandroid on December 6, 2021

The usual approach, which doesn't require any additional apps:

  1. Push to /data/tmp/;

  2. Copy on the device using adb shell, using cp if it's available on your device or cat if it isn't.

     > adb push data.db /data/tmp/data.db
     > adb shell
     # su # or run-as com.me.app
     # cp /data/tmp/data.db /data/data/com.me.app/databases/data.db
    

Remembering to change com.me.app to the correct package name for your app.

Answered by Alexey Romanov on December 6, 2021

Edit: I found a work-around: AirDroid allows me to upload the file, but the permissions on the file are set to this:

-rw-------

Performing the following commands solves this problem (from Windows 7 command prompt).

>adb shell
# su
# chmod 777 /data/data/com.me.app/databases/data.db

Answered by yohosuff on December 6, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP