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

前端 未结 15 835
执笔经年
执笔经年 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.

提交回复
热议问题