Su access to /data/data - Magisk

Hi, i try to exec "su ls /data/data" from java code. But can see only too folder
com.myproject.test and com.google.android.gms
su -v # 24.3:MAGISKSU
su whoiam #root
If i exec this command in termux i will get full list of applications. What is problem and how can i fix that?

your use of "su" is bad ... to launch a command as root from within a program, you should use the "-c" switch (as mentionned in man page). every android app is sandboxed, so you see the content of your application's directory (/data/data/<APP name>).
"man su" to read more (on android, or on linux to read with a large screen).
"su whoami" launch whoami and I suppose you're using termux as root

Related

Uninstalling an APK via command prompt?

I found this website: http://www.androidkit.com/steps-to-install-and-uninstall-apk-file-on-android-g1-device
Section 3: Uninstalling the .apk file from the G1 device before installing the same .apk again.
1. In the G1 Phone, Go to Applications Menu ->Settings->Manage Applications.
2. Select the application which you want to Uninistall, and click on the ‘Uninstall’ button.
3. Follow steps 6 and 7 of Section 1.
Section 4: Uninstalling the .apk file (from the Device or Emulator) using adb shell.
There is an adb uninstall command which always shows Failure!!!
Using adb shell :
Important: The device has to be unplugged from USB if you are trying to uninstall from the emulator, else emulator should not be open and device needs to be plugged in the USB of the PC if you are trying to uninstall from the G1 Device. If either of them are not connected the adb shell command will not work
Go to the shell and making sure adb is in PATH:
Go to shell (from cmd->adb shell or directly through a terminal)
#
#cd data
#cd app
#cd ls
You will get a list of installed application with the complete package name of the package containing the main activity. e.g com.company.product.apk
#rm com.company.product.apk
#cd ls
You will not find the application – you just removed it!.
Click to expand...
Click to collapse
So, when I type:
Cd Data
Cd App
Cd ls
in my command prompt I get:
cd: can't cd to ls
$
as a prompt feedback.
----
I found an .APK to enable my headphone adapter working ( see this thread: http://forum.xda-developers.com/showthread.php?t=575534 ) via this board ( see this thread: http://forum.xda-developers.com/showthread.php?t=511704 ), and if it doesn't work, I'm taking precautions on how to uninstall it.
Anyone know why it's doing this?
Thanks people.
Minifig said:
I found this website: http://www.androidkit.com/steps-to-install-and-uninstall-apk-file-on-android-g1-device
So, when I type:
Cd Data
Cd App
Cd ls
in my command prompt I get:
cd: can't cd to ls
$
as a prompt feedback.
----
I found an .APK to enable my headphone adapter working ( see this thread: http://forum.xda-developers.com/showthread.php?t=575534 ) via this board ( see this thread: http://forum.xda-developers.com/showthread.php?t=511704 ), and if it doesn't work, I'm taking precautions on how to uninstall it.
Anyone know why it's doing this?
Thanks people.
Click to expand...
Click to collapse
the command should be "ls" not "cd ls"
also, if you know the package name you could use adb: adb uninstall <package_name>
and if you're just trying to install an app that you already have (such as updating the app) you could use adb and not have to uninstall first with: adb install -r app_name.apk
OK.
I'm just going to make sure before I even install this thing:
http://code.google.com/p/toggleheadset/downloads/detail?name=ToggleHeadset.apk&can=2&q=
This is just a widget, so it won't replace anything in my phone..
If I can't find it on the shell command, I'll be able to uninstall it via the phone like the Date widget I have as well?
Right?

Running script not possible cyanogen 4.2.1?

I wrote a small script with a wget command:
wget https://xxxxxxxlain.html?url=&meth=plain&action=login&time=480&uid=xxx&pswd=xxxx&submit=1
the script is called sesame
Put in on root of sd
terminal emulator:
Code:
$ su
# chmod 777 sesame
# ./sesame
: permission denied
How can that be?
Because the G1 uses ash, not bash, as its shell/CLI.
Rather than "./", use "sh ./"
IConrad01 said:
Because the G1 uses ash, not bash, as its shell/CLI.
Rather than "./", use "sh ./"
Click to expand...
Click to collapse
also, unless you had previously cd'ed to sdcard you must add the path so
Code:
sh /sdcard/sesame
should work
That's implicit when you understand the "." to mean "current directory".
I.e.; "find . -print" will print out every file in your current directory in a list. Going a step fancier you could also use "find . | grep .apk" to find all .apk's in your active directory.
Fun with commands!

[Q]I'm trying to make a little .cmd file to uninstall my apps. need a little help.

Trying to make a little .CMD Files to uninstall my app so I don't have to type everything in again when I do a flash rom.. here is what I have
Code:
pause
@adb kill-server
@adb shell cd /system/app/
@adb shell su*
pause
@adb shell rm /system/app/RemotePVR.apk
@adb shell rm /system/app/tn55-android-blur.apk
@adb shell rm /system/app/FaceRecognition.apk
@adb shell rm /system/app/Layar-samsung.apk
pause
The issue is at the "@adb shell su*" I get an error saying at the super not found.. now when I type the commands in my self it works great.. but in a .bat file or .cmd files it does not work.. what i'm I missing?
Every call to ADB like this is a standalone command.
That is, when you do a
Code:
adb shell cd /system/app/
what happens is that it starts the adb shell, runs the command, and then exits. So when you call su, you lose superuser access when running the next adb shell command, because that shell instance is now gone, kaput, finito.
I also tried to make a script like this, but got stuck. We need to chain commands to ADB, like you can do in *nix with a semi-colon separator between command, like thus:
Code:
command1 ; command2
("&&" in Windows/DOS)
But ADB doesn't seem to support chaining commands.
I guess you have to do a shell script, put it on the phone and run it from there. Or some kind of "adb sushell" command would be nice...
Thanks I was kinda wondering if that was what was happening.. to bad the su command would not stay active.. o well.... maybe someone will come up with something..
Im not at a pc but can u test
adb shell su command
Does tht work ?
you could make a 2nd script which pushes the 1st to the device with "adb push". this script then gets root with "su" and uninstalls/deletes the apps ... btw. you can try using "pm" (packetmanager) which can install/uninstall/reinstall apps. however i don't know if it works with system apps...
Alright here : (eg, say remove launcher)
Code:
adb shell su -c 'mount -o rw,remount /dev/block/mtdblock3 /system'
adb shell su -c 'rm /system/app/Launcher.apk'
adb shell su -c 'rm /system/app/Launcher.odex'
adb shell pm uninstall com.android.launcher
fyi : "SystemApp Remover" on market essentially does the same thing, except it eliminates the need for u to look for the package name ur self.
Hm, that works, but I get a superuser prompt on the phone for every new command (the "app name" is the command line).
Daneshm90 said:
Alright here : (eg, say remove launcher)
Code:
adb shell su -c 'mount -o rw,remount /dev/block/mtdblock3 /system'
adb shell su -c 'rm /system/app/Launcher.apk'
adb shell su -c 'rm /system/app/Launcher.odex'
adb shell pm uninstall com.android.launcher
fyi : "SystemApp Remover" on market essentially does the same thing, except it eliminates the need for u to look for the package name ur self.
Click to expand...
Click to collapse
sweet that worked. I would get the SystemApp Remover but I can't download paid apps till Google will fix my account. unless there is something like it for free.

Rooting/unlocking Nexus One with broken power button using Linux terminal tools

I am attempting to get Cyanogenmod onto my Nexus One, but am running into far more problems than expected. The information on rooting Android devices seems heavily fragmented across the web and the tools unreliable. At least in my case, SuperOneClick has proven a complete misnomer. So I'd like to go back to basics - executing as many of the commands as possible from a Linux terminal to get the phone rooted/unlocked/whatever else has to happen to get Cyanogenmod installed. The two constraints I'm working with here are as follows:
1. The device is running Android 2.2.1 (I downgraded from 2.3.x using the PASSIMG method).
2. The power button on the device is broken, so any method which requires pressing/holding it is ruled out.
The problem I am having is that even after following Linux-centric guides, I get to the point of installing the SuperUser app followed by the ROM Manager app, but I'm never prompted to give ROM Manager superuser permissions and so can't flash the ClockworkMod recovery.
Below I describe the steps I've been taking so far, based on the "How To Root Nexus One Running Android 2.2.1 From Ubuntu Linux" guide (Google it, I can't post hyperlinks).
- Download/extract/move Nexus One Softroot files to same directory as adb
- From adb directory, execute the following commands:
sudo ./adb push psneuter /data/local/tmp/psneuter
sudo ./adb push busybox /data/local/tmp/busybox
sudo ./adb push su /data/local/tmp/su
sudo ./adb shell chmod 755 /data/local/tmp/psneuter
sudo ./adb shell chmod 755 /data/local/tmp/busybox
sudo ./adb shell chmod 755 /data/local/tmp/su
sudo ./adb shell cd /data/local/tmp ./psneuter
sudo ./adb shell
After executing sudo ./adb shell as above, I get the # prompt, which is purported to indicate that rooting was successful.
- Still following the guide, I then execute the commands which purportedly make root permanent:
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
cd /data/local/tmp
./busybox cp busybox /system/bin
chmod 4755 /system/bin/busybox
busybox cp su /system/bin
chmod 4755 /system/bin/su
exit
exit
- Again, still following the guide, I execute the commands which purportedly set the /system partition back to read-only:
sudo ./adb shell
su
mount -o remount,ro -t yaffs2 /dev/block/mtdblock3 /system
exit
exit
- Now, I download the SuperUser app from the Android Market and open it to make sure it's running.
- Next, I download the ROM Manager app from Google Play (looks like it pulled a sneaky and upgraded from Android Market to Google Play here).
- I run ROM Manager and choose Flash ClockworkMod Recovery. I'm prompted to confirm the phone is a Google Nexus One and then ROM Manager runs for about 30 seconds (yellow program bar goes all the way) before spitting out An error occurred while attempting to run privileged commands!. And this is the point I am stuck at.
I should note that at no point am I prompted by the SuperUser app to give the ROM Manager app super user permissions. I don't restart the phone or do anything else throughout all of the steps I've described above, so I can't see any reason for root to have been lost at any point. In fact, if I execute the command sudo ./adb shell after all this, I still get the # prompt indicating root. And when I execute id afterwards, I get uid=0(root) gid=0(root) -- further confirmation of root. I really am stuck on this one. I've spent a lot of time digging through forum posts and online articles, but the signal to noise ratio is poor and I haven't been able to find anything that actually works. Can someone suggest where I am going wrong?
Programs might expect su to be in /system/xbin rather than /system/bin, which is probably your case.
Also, use SuperSU instead of Superuser.
Also, make sure the su you're using is matching the relevant control program - which means, downloading Superuser from the Play Store won't help, if it can't work with the binary you have. So download a complete ZIP from XDA with SuperSU.apk and su binary, and use those. The last version I used was 0.89 and it was on XDA just like I described above.
interesting problem with ez fix, get new phone. n1's are $100 on ebay, thats how i got mine.

[Q] Rooting problems regarding permission

Hi, I'm a newbie to android rooting and have spent the whole day trying to root my Kindle Fire HD v7.2.3.
I've used the bin4ry RunMe.bat and RootQemu.bat. I have no problems with the Qemu part but as for the RunMe.bat part I get permission problems (see picture below)
http://www.freeimagehosting.net/ikz64
The device gets rooted but the super user is no where to be seen. Therefore I can access root files but I can't write as it is read only.
I've already tried this: http://forum.xda-developers.com/showthread.php?t=2086210 (fixing a bug)
I've also tried the basics of rebooting after rooting, run as admin, locate through cmd but nothing has worked for me so far.
Anyone know what the problem is?
I was having a similar permission denied error when rooting 7.2.3. Try this and see if it helps. These commands are pulled from the Qemu script.
Code:
adb shell mv /data/local/tmp /data/local/tmp.bak
adb shell ln -s /data /data/local/tmp
adb reboot
Wait for the device to reboot then run these.
Code:
adb shell rm /data/local.prop
adb shell "echo ro.kernel.qemu=1 > /data/local.prop"
reboot
Now wait for the device to reboot then check if the Qemu root hack worked correctly by connecting to your device with adb shell. You should see a root prompt.
Code:
$ adb shell
[email protected]:/ #
If you see a root prompt then re-run the RunMe.bat script and it should complete without error. The reason for your permission denied error is the script is not running as root.

Categories

Resources