copy db file with adb pull results in 'permission denied' error

前端 未结 15 777
执笔经年
执笔经年 2020-12-13 17:13

I just rooted my Nexus 5 using this method: http://www.phonearena.com/news/How-to-root-Google-Nexus-5_id49014

I also enabled USB debugging in the developer options.<

相关标签:
15条回答
  • 2020-12-13 18:01

    This generic solution should work on all rooted devices:

     adb shell "su -c cat /data/data/com.android.providers.contacts/databases/contacts2.db" > contacts2.d
    

    The command connects as shell, then executes cat as root and collects the output into a local file.

    In opposite to @guest-418 s solution, one does not have to dig for the user in question.

    Plus If you get greedy and want all the db's at once (eg. for backup)

    for i in `adb shell "su -c find /data -name '*.db'"`; do
        mkdir -p ".`dirname $i`"
        adb shell "su -c cat $i" > ".$i" 
    done
    

    This adds a mysteryous question mark to the end of the filename, but it is still readable.

    0 讨论(0)
  • 2020-12-13 18:07

    Did you try adb remount after giving adb root?

    0 讨论(0)
  • 2020-12-13 18:07
    $ adb shell
    $su
    # getenforce
    Enforcing
    

    now try

    adb shell
    su
    chmod 777 /path/to/yout_file
    

    exit from shell

    open new CMD and try adb pull /path/to/yout_file

    It will work fine now.

    you'll have security problems because of this any application will be able to access your database.

    0 讨论(0)
提交回复
热议问题