adb를 사용할 때 데이터 폴더에 대한 액세스가 거부되는 이유는 무엇입니까?
adb와 다음 명령을 사용하여 라이브 장치에 연결했습니다.
C:\>adb -s HT829GZ52000 shell
$ ls
ls
sqlite_stmt_journals
cache
sdcard
etc
system
sys
sbin
proc
logo.rle
init.trout.rc
init.rc
init.goldfish.rc
init
default.prop
data
root
dev
$ cd data
cd data
$ ls
ls
opendir failed, Permission denied
액세스가 거부 된 것을보고 놀랐습니다. 이런 명령 줄을 사용하여 디렉토리를 탐색 할 수없는 방법은 무엇입니까?
전화기에서 루트 액세스 권한을 얻으려면 어떻게합니까?
장치에서 모든 것을 탐색하려면 기억해야 할 두 가지가 있습니다.
- Android 전화에서 데이터 폴더를 찾아 보려면 루트 액세스 권한이있는 전화가 있어야합니다. 즉, 개발자 기기 ( ADP1 또는 Google I / O 의 ION )가 있거나 다른 방법으로 휴대 전화를 ' 루팅 '하는 방법을 찾았다는 의미입니다.
- 루트 모드에서 ADB를 실행해야합니다. 다음을 실행하여 수행하십시오.
adb root
API 레벨 8 (Android 2.2)부터 디버깅 가능한 애플리케이션 (릴리스 빌드가 요청되지 않은 한 Android Studio에서 항상 빌드 한 애플리케이션)의 경우 쉘 run-as
명령을 사용하여 특정 사용자 / 애플리케이션으로 명령 또는 실행 파일을 실행할 수 있습니다. 또는 응용 프로그램 의 UID 로 전환하여 해당 데이터 디렉토리에 액세스 할 수 있습니다 .
yourapp의 디렉토리 내용을 나열하십시오.
run-as com.yourapp ls -l /data/data/com.yourapp
com.yourapp의 UID로 전환 하고을 호출 할 때까지 해당 uid를 사용하여 추가 명령을 모두 실행하십시오 exit
.
run-as com.yourapp
cd /data/data/com.yourapp
ls -l
exit
참고 1 : 일부 HTC Desire 전화 에는 알려진 문제 가 있습니다. /data/data
디렉토리 의 비표준 소유자 / 권한으로 인해 run-as
해당 전화에서 명령이 실행되지 않습니다.
참고 2 : @Avio의 의견에서 지적 했듯이이 run-as
플랫폼 /data/data
에서는에 대한 symlink 이기 때문에 모든 버전 (7에서 10.1까지)에서 Cyanogenmod를 실행하는 Samsung Galaxy S 전화에도 문제가 있습니다 /datadata
. 이 문제를 해결하는 한 가지 방법은 symlink를 실제 디렉토리로 바꾸는 것입니다 (불행히도 일반적으로 루트 액세스가 필요합니다).
우리가 시작하기 전에, 당신이해야 할 뿌리 전화를? 그렇지 않다면, 당신이 점프를 할 시간이라고 강력히 제안합니다. 이 작업을 수행하는 데 도움이되는 자습서의 99 %는 루팅 된 전화가 필요합니다 (루팅 된 전화가 없어도 전화를 끊는 방법을 찾기 위해 한 시간 정도 일한 b / c는 알고 있습니다 .. ) 또한 당신이 그것에 대해 생각한다면, 동일한 작업을 수행하기 위해 iPhone도 뿌리를 내려야합니다. 따라서 합리적입니다. 대답의 끝에서 응원에 대한 자세한 내용.
명령 행 유형에서 :
adb shell
이것은 당신을 당신의 안드로이드 쉘 comand 줄로 데려갑니다 (다음과 같이 보일 것입니다 : shell@android:/ $
지금 입력하십시오 :
shell@android:/ $run-as com.domain.yourapp
이것은 다음의 데이터 디렉토리로 직접 이동해야합니다 com.domain.yourapp
.
shell@android:/data/data/com.domain.yourapp $
그렇지 않은 경우 (즉, 오류가 발생하는 경우) 루팅 된 전화가 없거나 루트 사용자 권한을 사용하지 않은 것입니다. 루트 사용자 권한을 사용하려면 su
adb 명령 줄에 입력 하고 오류가 발생하면 어떻게되는지 확인하십시오. 전화가 루팅되지 않은 것입니다. 그렇지 않은 경우 먼저 루팅 한 후이 지시 사항을 계속하십시오.
거기에서 입력 ls
하면 db를 포함한 모든 디렉토리를 볼 수 있습니다 .
shell@android:/data/data/com.domain.yourapp $ ls
cache
databases
lib
shared_prefs
그 후 sqlite3을 사용하여 dbase를 찾아 볼 수 있습니다. 설치되어 있지 않은 경우 (입력 한 sqlite3
경우 입력하여 찾을 수 있음) command not found
sqlite를 설치하려면 여기의 지시 사항을 따르십시오 .
응원에 대해 : 당신이 전에 휴대 전화를 근절 하지 않고 전화를 망치 걱정이 있다면, 나는 걱정할 것이 없다고 전적으로 확신 할 수 있습니다. 거기에 거의 모든 새롭고 오래된 모델에 대한 빠르고 쉬운 전화 응원 자습서 가 있으며 Mac이있는 경우에도 휴대 전화를 응원 할 수 있습니다 (내 Mac과 함께 내 s3를 응원했습니다 ).
$ adb 쉘
$ cd / data
$ ls
opendir 실패, 권한 거부
이 작업을 수행해야합니다.
$ adb shell
$ cd /data
shell@android:/data $ run-as com.your.package
shell@android:/data/data/com.your.package $ ls
확인!
루팅 된 Samsung Galaxy S에서 작동하려고 할 때 비슷한 문제가 발생했습니다. 컴퓨터 셸에서 명령을 실행합니다.
> adb root
"프로덕션 빌드에서 루트로 실행할 수 없습니다"라는 메시지와 함께 실패합니다. 다음은 루트가 될 수있는 간단한 방법입니다.
위의 명령 대신 다음 두 명령을 차례로 실행하십시오.
> adb shell
$ su
첫 번째 명령 다음에 위와 같이 프롬프트가 '>'에서 '$'로 변경된 경우 adb 쉘 환경에 들어갔다는 의미입니다. 두 번째 명령을 실행 한 후 프롬프트가 '#'으로 변경된 경우 이제 루트 상태입니다. 이제 루트로 장치에서 원하는 모든 것을 할 수 있습니다.
'안전한'쉘로 다시 전환하려면
# exit
프롬프트 '$'가 다시 나타납니다. 이는 루트가 아닌 사용자로서 adb 쉘에 있음을 의미합니다.
I had a lot of trouble with this also. I still don't fully understand the permission and root run, but this worked for me (one of the previous answers partly) to copy database file from /data/data/[package name]/databases/my_db.db . Running shell root, or su in shell for some reason didn't work, nor did copying the db file (I could navigate to the directory though), nor did sqlite3.
So, this worked! In DOS command prompt:
C:\Program Files\Android\android-sdk\platform-tools>adb shell
1|shell@android:/ $ run-as de.vogella.android.locationapi.maps
run-as de.vogella.android.locationapi.maps
1|shell@android:/data/data/de.vogella.android.locationapi.maps $ cd /data
cd /data
shell@android:/data $ cd data
cd data
shell@android:/data/data $ cd de.vogella.android.locationapi.maps
cd de.vogella.android.locationapi.maps
shell@android:/data/data/de.vogella.android.locationapi.maps $ cd databases
cd databases
shell@android:/data/data/de.vogella.android.locationapi.maps/databases $ ls
ls
bus_timetable_lines.db
bus_timetable_lines.db-journal
shell@android:/data/data/de.vogella.android.locationapi.maps/databases $ cat bus
_timetable_lines.db > /sdcard/db_copy.db
bus_timetable_lines.db > /sdcard/db_copy.db <
shell@android:/data/data/de.vogella.android.locationapi.maps/databases $exit ^
exit
shell@android:/ $ exit
exit
C:\Program Files\Android\android-sdk\platform-tools>
Now go to SDCARD directory and get your file db_copy.db . Even that was hidden, but I managed to email it. Back in Windows, I was able to open db file with SQLite Database Browser. :)
Following are the two steps to get root access:
- Your android devices must be rooted.
- In ADB shell, type su and the android device will prompt y/n? You choose allow.
production builds can't enter /data/app
drwxrwx--- system cache 1970-01-01 08:00 cache
drwxrwxr-x root system 1970-01-01 08:00 mnt
drwxrwx--x system system 1970-01-01 08:15 data
might need change to right owner to operate it.
The problem could be that we need to specifically give adb root access in the developnent options in the latest CMs.. Here is what i did.
abc@abc-L655:~$ sudo adb kill-server
abc@abc-L655:~$ sudo adb root start-server * daemon not running. starting it now on port 5037 * * daemon started successfully * root access is disabled by system setting - enable in settings -> development options
after altering the development options...
abc@abc-L655:~$ sudo adb kill-server
abc@abc-L655:~$ sudo adb root start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
restarting adbd as root
abc@abc-L655:~$ adb shell
root@android:/ # ls /data/ .... good to go..
if you know the application package you can cd
directly to that folder..
eg cd data/data/com.yourapp
this will drop you into a directory that is read/writable
so you can change files as needed. Since the folder is the same on the emulator
, you can use that to get the folder path.
If you just want to see your DB & Tables then the esiest way is to use Stetho
. Pretty cool tool for every Android developer who uses SQLite
buit by Facobook developed
.
Steps to use the tool
- Add below dependeccy in your application`s gradle file (Module: app)
'compile 'com.facebook.stetho:stetho:1.4.2'
- Add below lines of code in your Activity onCreate() method
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Stetho.initializeWithDefaults(this); setContentView(R.layout.activity_main); }
Now, build your application & When the app is running, you can browse your app database, by opening chrome in the url:
chrome://inspect/#devices
Screenshots of the same are as below_
ChromeInspact
Your DB
Hope this will help to all! :)
without rooting the device you can access the files by the following The cmd screenshot:
start the adb using cmd from the platform-tools folder according to your user
cd C:\Users\YourUserName\AppData\Local\Android\sdk\platform-tools
it can be in another folder depends on where you installed it.
display the working devices.
adb devices
for say the respond os the command is
List of devices attached 0123456789ABCDEF device
write the command
adb -s 0123456789ABCDEF shell "su"
it will open in
root@theDeviceName:/ #
4.Accessing files, list all the files
ls
and so-on chang directory to any where else like the data folder
cd data/data
When you are in the shell directory for the device. Just run
su - root
Then you should be able to access the data/ folder.
참고URL : https://stackoverflow.com/questions/1043322/why-do-i-get-access-denied-to-data-folder-when-using-adb
'IT' 카테고리의 다른 글
Oracle SQL에서 세미콜론과 슬래시를 언제 사용해야합니까? (0) | 2020.05.25 |
---|---|
UIButton에서 테두리를 만드는 방법은 무엇입니까? (0) | 2020.05.25 |
둥근 사각형 텍스트 필드처럼 UITextview의 스타일을 지정하는 방법은 무엇입니까? (0) | 2020.05.25 |
부트 스트랩 3 바닥 글을 바닥으로 플러시합니다. (0) | 2020.05.25 |
인코딩 / 디코딩의 차이점은 무엇입니까? (0) | 2020.05.24 |