Android rootshell: permission denied — sony xperia and MacOSX - android

so I'm trying to get root access on my Android in order to use Barnacle. But I keep getting the same error, over and over:
$ adb shell
$ rootshell
rootshell: permission denied
What is the deal with this? I mean, seems logical that I need some permissions to access rootshell, but I can't seem to find any way around it.
Anybody knows how?
Is there any other way to get root access to your phone? (An easy way, hopefully)
EDIT 1:
I will clarify the question.
Unix and Linux systems let you retrieve / change lost passwords for root user. Considering this:
Is there an easy way to root an Android device using the terminal on my Mac OS X? My device is an Xperia X10 mini pro.
Or, does anybody know why I get that permission denied error using adb and rootshell in the first place? It's supposed to work, as stated here?
Thnx!
A.

I'm not sure how much of a question this is or not or whether it is appropriate for StackExchange, but I'm gonna answer it anyway. I don't have enough rep to do anything else about the anyway :D
When you are trying to root any android phone in general, you need to run a program that gives you root access. You can't just simply say "adb give-me-root-permissions-please". :) But yeah, Google is your friend in this case. Apparently your phone the Sony Xperia needs a very specific rooting process that is enumerated here: http://forum.xda-developers.com/showthread.php?t=711907
I would recommend asking this kind of question THERE on XDA because that site is dedicated to questions like this. This site is for programming questions and the like :)

TO BE ROOT AT SONY XPERIA
you can use
king root software
or
rootkitXperia L
how to get temproot by 'getroot'
usage
push 'getroot' in device, set permission, and execute 'getroot'
adb push getroot /data/local/tmp
adb shell
$ cd /data/local/tmp
$ chmod 0755 getroot
$ ./getroot
use CVE-2013-6282 vulnerability
kernel start address 0xc0008000
In some cases, modify KERNEL_START_ADDRESS or KERNEL_SIZE in 'getroot.c'

Related

Mount USB stick on android Nexus 7

My application needs to access files on a usb stick from a rooted Nexus7 tablet over an OTG cable. I have been looking into this extensively and found a few related posts but no real answer.
I know this is possible, because I can mount it with stickmount though I can't use third party software, so I need to somehow re-implement this myself.
When I plug in the USB stick it appears as 001 in /dev/bus/usb/001, so I was hoping it would be as simple as:
Runtime.getRuntime().exec("su -c \"mount /dev/bus/usb/001/001 /sdcard/test\"");
but that doesn't work. A little toast pops up with
myApp has been given superuser permissions:
mount /dev/bus/usb/001/001 /sdcard/test
But it isn't mounted.
Am I formatting the command wrong, or is this the completely wrong way to go with it? Any ideas on how I could get this thing to mount?
Thanks

Android command list

I have many questions about Android command. I do not know where I should start But, anyway, I have put all question related Android commands. Here ;
Is subset of Linux commands come in Android by default ? Or, Are we installing something ?
In system/bin, there are lots of commands. Where can I find their meaning ? I have tried man, but man is not built in.
Can I start and stop application via start and stop command ?
Why cannot I run the reboot from terminal emulator ? The error permission is denied.
NOTE : feel free to reedit the question, if you see meaningless part.
Is subset of Linux commands come in Android by default ? Or, Are we installing something ?
A subset exists by default within the system. Things like ls, cd, mkdir, cat etc... are present. You can gain access to a wider range by installing Busy Box on a rooted device, as stated by Zac.
In system/bin, there are lots of commands. Where can I find their meaning ? I have tried man, but man is not built in.
The ADB Page is a good place to start. That covers many of the basic ADB and shell commands. It states near the bottom:
"For a complete list of commands and programs, start an emulator instance and use the adb -help command."
So you can use adb -help on an emualator or device to see a full list of the ADB and shell commands (note I think this list will be android specific commands only, it won't include things like cd,ls and other basic unix commands).
Can I start and stop application via start and stop command ?
No, it states on the ADB dev page:
start ........ Starts (restarts) an emulator/device instance.
stop ........ Stops execution of an emulator/device instance.
To start an application you'll use the am utility iirc it will look something like am start com.your.packagename It's been a while though, I might have syntax wrong. The instructions are listend if you issue the am command by itself with no params in a shell.
Why cannot I run the reboot from terminal emulator ? The error permission is denied.
The system prevents applications from rebooting the device unless they are signed with the same key as the OS. When you use the terminal emulator you are restricted to whatever permissions that application has declared. The reboot permission is not granted to any third party applications, so it won't work correctly from any terminals. You could probably do it if your device was rooted and you used su though
EDIT:
Here is another good resource that lists more of the shell commands
There are not many Linux commands included in android, however if you are rooted you can easily install busybox which has a large range of linux commands.
You need to have root access to reboot your device via the command line (to prevent any old app being able to do it)

Testing if a phone is rooted [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Determine if running on a rooted device
I would like to know just whether or not a phone is rooted, without requesting root privileges. How can I do that?
Testing if File.Exists("/system/bin/su")? Not sure, I think I cannot due to permissions
Testing if Superuser app is installed? Hmm, I think I need a special permission to use PackageManager and Superuser is not the onlu su manager (I know SuperSU for example)
Trying to run su is not an option because it triggers the su prompt which is something I don't want in a non-root app
Any idea? My purpose is to obtain anonymous statistics on how many devices are rooted, obviously with user's consent :)
Option 1. It is possible, it doesn't need any special permission.
Option 2. The rooted phone may not come with any Superuser manager application.
Option 3. As you said, it's not a good way to detect.
Besides, there's another option that is to check ro.build.tag (using getprop | grep ro.buil.tag or android.os.Build.TAG) if it contains testkeys string.
Edit: for option 1, I would suggest you find by setuid/setgid permission (i.e. find / -perm -2000 -o -perm -4000, and check if su is in the list)
You cannot reliably do this, as what it means for a phone to be "rooted" is not always the same. What all the proposals you will get do is test for some of the popular root-related tools. But it is not possible to detect if the phone has been rooted in a way that does not utilize those tools.

Setting up an Android device under Linux for development, without root

Hello StackOverflowers,
I am eager to try out some Android programs on my tablet in the early phase. However, I do not have root access to the Linux machine I am using (OpenSUSE 12.1). Due to this, I am having trouble to let the system find my device.
This tutorial http://developer.android.com/tools/device.html, as well as almost every post I can find online, do not mention ways to walk around the 51-android.rules setting without root. Some post even mention that, to find the device, the adb command should be run with root.
Does this mean I have no hope of on-device debugging? Thanks in advance!
I dont think you need root access for adb. Though for the device to be detected, AFAIK you need to add device details in rules.d .
If you have device and the computer on the same network, you could use adb over wifi. But to put the device in tcp mode , you need root access on phone or another computer where device can be detected.
Your device doesn't have to be rooted. After you add your device in 51-android.rules, make sure you restart adb server by using these commands:
adb kill-server
adb start-server
And one more thing, make sure you turn On Debugging Mode

execute "su" failed in my fully rooted Android device

while i add this line to my code
Process process = Runtime.getRuntime().exec("su -c");
or
Process process = Runtime.getRuntime().exec("su");
trying to run the"su" command,
process.exitValue() returns 1 which means fail.
This happens to my one Android device while my the other rooted android device works perfectly with this command. (process.exitValue() returns 0)
Can anyone teach me how to trace the error or how to fix it?
I am confused with this error while my two devices almost in the same condition.
Thanks for your reply in advance.
Hi guys,
Thanks for discussing this issue with me. Your reply hints me a clue that I have removed my old su and place a new su. Luckily enough, the return value is now 0 and I guess it means correct. However, Does any of you might know what is the difference between .exec("su -c") and .exec("su")? Please let me know if you know the difference.
I suspect you lack Superuser on the problematic phone, do you?
Or at least something about Superuser could be wrong (versions, binaries...)
su calls Superuser which allows root access or not.
Many problems seems to occurs on latest versions of Superuser.
Try to remove it and install other version:
http://goo.im/superuser
Another note: if you're trying to gain root access or to execute commands as root, you should not only use exec("su"). Take a look at the RootTools a library by stericson himself ;)
http://code.google.com/p/roottools/
The command su (which means Super User) is only valid on rooted phones. That is why your rooted phone recognizes it and works as expected. So, either you root your other device(s) or drop this idea on non-rooted phones :)
Since this is the only result I got for searching for the phrase, thought I'd post an update for anyone else coming across this.
Was following the instructions for installing Cyanogenmod. My issue was resolved by disabling Mass Storage mode on the device (change it to one of the other options).

Categories

Resources