[Q] SuperUser Commands - Android Software Development

What for SuperUser command does exists?
Is there a List?

How can i get the file from
/data/data/com.android.providers.settings/databases/settings.db ?
i used:
adb pull /data/data/com.android.providers.settings/databases/settings.db C:
but it says:
failed to copy '/data/data/com.android.providers.settings/databases/settings.db' to 'C:': Permission denied
any solution?

try typing
Code:
su
or if not try
Code:
adb remount
I dont know much about this stuff yet, but that could help

ilendemli said:
How can i get the file from
/data/data/com.android.providers.settings/databases/settings.db ?
i used:
adb pull /data/data/com.android.providers.settings/databases/settings.db C:
but it says:
failed to copy '/data/data/com.android.providers.settings/databases/settings.db' to 'C:': Permission denied
any solution?
Click to expand...
Click to collapse
are you rooted?
try:
Code:
adb shell "su -c 'cp /data/data/com.android.providers.settings/databases/settings.db /sdcard/'"
this will use su to copy it to the sdcard, then you should be able to pull it from there. Phone may pop up a "Superuser request". Be prepared to allow it.

when i type:
adb shell "su -c '/data/data/com.android.providers.settings/databases/settings.db /sdcard/'"
It says:
/data/data/com.android.providers.settings/databases/settings.db: permission denied
My Device is rooted, and i gave su permission

You forgot the "cp" between "su -c" and "/data/data/..."

C:\Users\ilendemli>adb shell "su -c '/data/data/com.android.providers.settings/databases/settings.db /sdcard/'"
/data/data/com.android.providers.settings/databases/settings.db: permission denied
C:\Users\Muhammet ilendemli>adb shell "su -c 'cp /data/data/com.android.provider
s.settings/databases/settings.db /sdcard/'"
cp: not found
My CMD Window, whats wrong?

Hum, that's strange.
Try this : (<Enter> means pressing the Enter key on your keyboard)
adb shell <Enter>
su <Enter> (here you may have to look at your phone to give him the autorisation it needs)
cp /data/data/com.android.providers.settings/databases/settings.db /sdcard/ <Enter>
If it says "cp: not found", try this line :
busybox cp /data/data/com.android.providers.settings/databases/settings.db /sdcard/ <Enter>

busybox: not found

Try to replace busybox by bb in the command I gave you.
If it doesn't work, well, I'll doubt you did your root well ^^ Cause it should have install BB
Can you explain us what you did to root your phone ?

I used SuperOneClick Root, to root my Phone. it installed the su files and superuser.apk nothing else
EdIT:
I installed busybox manually and rebootet my phone, now when i type:
>adb shell "busybox -c cp '/data/data/com.android.providers.settings/databases/settings.db /sdcard/'"
it says:
-c: applet not found
EDIT2:
>adb shell
$ busybox cp /data/data/com.android.providers.settings/databases/settings.db /sdcard/
busybox cp /data/data/com.android.providers.settings/databases/settings.db /sdcard/
cp: can't open '/data/data/com.android.providers.settings/databases/settings.db': Permission denied
$

That's normal, you missed the "su" command in your Edit 2.
So, 2 ways to do it.
Edit 1 version :
adb shell "su -c busybox cp '/data/data/com.android.providers.settings/databases/settings.db /sdcard/'"
Edit 2 version :
adb shell
su
busybox cp /data/data/com.android.providers.settings/databases/settings.db /sdcard/
And I thought SuperOneClick did install BB... Well, I thought wrong ^^

Edit 1 version: Didnt worked..
Edit 2 version: WORKED!? i have the database,
now, how can i give these command in java?
anything with exec("..

From adb, you can't execute Java methods (because you're not in a JVM).
And I don't think you can access the DB like that in fact.
You have to make an app that read/write/do what you want on the DB (and it seems you're doing so, refering to the other topic you made )

it's not allowed, to edit databases directly, so my app will copy the database somewhere else, edit it, and copy it back, then it should work.
€: and i don't want to edit databses from the adb, i cant do it, the program cant do it, but java can do it:
Code:
myDB.execSQL("DELETE FROM system WHERE name = 'name1';");
myDB.execSQL("DELETE FROM system WHERE name = 'name2';");
myDB.execSQL("INSERT INTO system (name, value) VALUES ('name1', '"+arr[0]+"');");
myDB.execSQL("INSERT INTO system (name, value) VALUES ('name2', '"+arr[1]+"');");

Yes it should.
Make sure you don't mess with the DB though. It's an easy thing to break
Edit : From adb, apparently you can do something like
sqlite3 settings.db
Then you'll have a DB prompt where you can write SQL commands like SELECT, INSERT, etc.

can busybox delete and replace files?

BB lets you use any Unix command.
So you can use (in your example) the mv command, which will move a file from a directory to another one.

Runtime.getRuntime().exec("busybox mv /sdcard/ /data/data/com.android.providers.settings/databases/settings.db");
this should work
E: Hmm, doesn't work..
E2: should look like this: Runtime.getRuntime().exec("busybox mv /sdcard/settings.db /data/data/com.android.providers.settings/databases/");
will try it.

Yes. But remember you have to be root to do that

Related

Allow Non Market Apps on Captivate

I see there is already a method to update non market app installs(sideloading), however it requires you buy Root Explorer(which is a good app to buy), but here is a guide for us cheap people:
This requires that you have already rooted your phone.
WINDOWS from the android sdk tools folder in a command prompt:
Code:
adb shell
su
chmod 666 /dbdata/databases/com.android.providers.settings/settings.db
exit
exit
adb pull /dbdata/databases/com.android.providers.settings/settings.db settings.db
echo update secure set value = 1 where name = 'install_non_market_apps';|sqlite3 settings.db
adb push settings.db /dbdata/databases/com.android.providers.settings/settings.db
LINUX/MAC from the android sdk tools folder in a terminal:
Code:
./adb shell
su
chmod 666 /dbdata/databases/com.android.providers.settings/settings.db
exit
exit
./adb pull /dbdata/databases/com.android.providers.settings/settings.db settings.db
echo "update secure set value = 1 where name = 'install_non_market_apps';"|./sqlite3 settings.db
./adb push settings.db /dbdata/databases/com.android.providers.settings/settings.db
Thanks to ATTN1 and FluffyArmada, most of it was stolen from the HTC Aria.
Thank you... I was trying to do this last night and kept having permissions problems.
the last step shld be
adb push settings.db /dbdata/databases/com.android.providers.settings/settings.db
Thanks, fixed the typos.
If I start a adb shell and add su, I get a access denied message.
Thanks for any help.
Shouldn't the line for pushing the file be:
Code:
./adb push [b]settings.db[/b] /dbdata/databases/com.android.providers.settings/settings.db
for linux/mac?
Thanks for the tutorial, by the way!
Edit: wow, nevermind, it's already been posted. That's what I get for not reading (and comprehending) the thread.
You're missing the first settings.db in the last command for windows. It should read
Code:
adb push settings.db /dbdata/databases/com.android.providers.settings/settings.db
smitty1 said:
If I start a adb shell and add su, I get a access denied message.
Thanks for any help.
Click to expand...
Click to collapse
Go to the homescreen of your phone, then type su in the command prompt. The Superuser app should pop up and ask for permission, just allow it then continue like normal.
unclejimbo88 said:
You're missing the first settings.db in the last command for windows. It should read
Code:
adb push settings.db /dbdata/databases/com.android.providers.settings/settings.db
Click to expand...
Click to collapse
Thanks, don't know how I missed that, I've updated the post.
no settings.db file
Hello,
Thank you for the video instructions.
shad0wf0x, I tried to input the command lines but it was stating:
Unable to chmod /dbdata/databases/com.android.providers.settings/settings.db: Operation not permitted
How do I get around that? Also, I looked in the phone's root directory and didn't see a folder named "dbdata".
Thank you in advance.
***Edit: Nevermind, I got it to install the way you showed on how to install SirusXM. Thank you.***
I've tacked this method into the consolidated thread, we're up to 5 methods now.
http://forum.xda-developers.com/showthread.php?t=738376
Even better, Sideload Wonder Machine. Doesn't even require root access.
Link to the app.
I'll reply in the my thread, so..
We really need a thank you system, really appreciate the spread of knowledge here, thanks
Got it to work perfectly for me, the other methods seem so much longer and more steps, this was very easy.
But you need to add one final step, turn off your phone and turn it back on or 'reboot' basically..
Thank you very much!
/dbdata/ is empty
This has been driving me bonkers for the past few days...I can't change settings.db because I don't HAVE settings.db. (And I get an 'insufficient permissions for device' error using ./adb shell anyway.) /dbdata/ is completely empty. A search from ASTRO shows no results for com.android.providers.settings or settings.db.
I have no idea what to do! None of these methods work for me, because they are all doing the same thing: editing a file which does not exist on my phone. (I should also point out that I don't really have access to a windows machine right now.)
Thanks in advance. Any help is appreciated.
MacBook:~ User$ cd /Users/User/Desktop/AndroidHacks/SDK/platform-tools
MacBooklatform-tools User$ ./adb shell
$ su
# chmod 666 /dbdata/databases/com.android.providers.settings/settings.db
# exit
$ exit
MacBooklatform-tools User$ ./adb pull /dbdata/databases/com.android.providers.settings/settings.db settings.db
1865 KB/s (52224 bytes in 0.027s)
MacBooklatform-tools User$ echo "update secure set value = 1 where name = 'install_non_market_apps';"|./sqlite3 settings.db
-bash: ./sqlite3: No such file or directory
MacBooklatform-tools User$ ./adb push settings.db /dbdata/databases/com.android.providers.settings/settings.db
815 KB/s (52224 bytes in 0.062s)
What did i do wrong exactly?
Help please
It appears you do not know what the following line is doing:
echo "update secure set value = 1 where name = 'install_non_market_apps';" | ./sqlite3 settings.db
The | character is called "pipe". It pipes the output of one command to the input of the next. In that line "echo" is a command and so is "sqlite3". The ./ prefix to sqlite3 is an explicit path to the command. Any path the begins with ./ is relative to your "current working directory". So, the original poster is assuming that you are doing this process from a location where there is a copy of sqlite3 in the current directory. And based on the error you got...
-bash: ./sqlite3: No such file or directory
...clearly this is not true.
I'm pretty sure that the Mac has sqlite3 present in the base install, and that it is located within your system $PATH (to be exact, /usr/bin/sqlite3). This means that you ought to be able to run that line without the explicit path. (That is to say change "./sqlite3" to "sqlite3".) Then you can do the "push" line again and you are set.
There is a lot of information in this post. Learn what it all means. The world has changed. Mac power users now have to know this stuff. Once you are comfortable with the idea of commands and piping, research $PATH, you'll learn something.

In Need of a translator CMD code to Terminal code for board sticky of Side loading ap

Been talking to Lekky and we have all these great things grouped into one thread. One important thread is side mounting the captivate.
Things it gives you are SDK which can be downloaded for PC or Mac.
Drivers again PC or Mac.
Then Root access no biggie
Busy box no biggie.
Then it goes into the CMD language for PC on how to edit the database file using CMD prompts to enable the sideloading of APKs directly on the phone.
What we are looking for is someone to translate this into mac terminal command lines. Here is how it reads now:
Connect USB to phone with USB Debugging ON
Command prompt
cd to SDK install directory
cd tools
adb shell
su
cp /dbdata/databases/com.android.providers.settings/settings.db /sdcard/settings.db
cp /dbdata/databases/com.android.providers.settings/settings.db /sdcard/settings.db.backup
exit
exit
(This should bring you back to your windows command prompt.)
adb pull /sdcard/settings.db %userprofile%\desktop
(This should copy the settings.db to your desktop in Windows. Keep your cmd window open, you'll need it again.)
Install SQLite Manager Plugin for Firefox
Open SQLite Manager Plugin within Firefox (Tools->SQLite Manager)
Click Database
Click Connect Database
Find settings.db
Expand Tables
Click secure
Scroll down to ID 6, "install_non_market_apps". Double-click.
Change value ( TEXT ) from 0 to 1
Close SQLite Manager
(Back to that cmd window)
adb push %userprofile%\desktop\settings.db /sdcard
adb shell
su
cp /sdcard/settings.db /dbdata/databases/com.android.providers.settings
busybox chown 1000 /dbdata/databases/com.android.providers.settings/settings.db
busybox chgrp 1000 /dbdata/databases/com.android.providers.settings/settings.db
reboot
Disconnect USB from phone. Your phone should be rebooting.
Done! I tested this and was able to install siriusxm.apk from siriusxm.com/android.
Who knows Mac Terminal commands well enough to translate this so that it can be posted in this sticky thread along with the windows version for us?
put ./ before each command
./adb pull /sdcard/settings.db %userprofile%\desktop
./adb shell
then carry on like normal
su
cp /sdcard/settings.db /dbdata/databases/com.android.providers.settings
busybox chown 1000 /dbdata/databases/com.android.providers.settings/settings.db
busybox chgrp 1000 /dbdata/databases/com.android.providers.settings/settings.db
reboot
then do the ./ again
./adb push %userprofile%\desktop\settings.db /sdcard
Also, if you *read* the sticky, it provides these notes, in blue, to make it more pronounced.
yea was on androidforums not here they didnt have the mac side, found it here after u guys mentioned it, awesome ty.

adb SU

Hi,
Just a little help for me please, I try to launch some adb command with SU
In my little head, I have think translate your code with the SU call before
Code:
adb shell uname -r
become
Code:
adb shell su uname -r
With the first command, all is good I have my answer, with the su first I have
Code:
Permission Denied
I have a DESIRE (bravo) rooted and S-OFF, what did I do wrong ?
The Linux su expects a user name as parameter, not a command. As far as I can see, the Android su simply ignores this parameter. If you want su to execute a command, use the -c option, like in
Code:
su -c uname -r
This causes su to execute "uname -r" as root, after that it returns immediately, so you're back at the user level you've been before. This might not be what you expect, but that's how it works.
Your permission error: Try a single su command, without any arguments or options. If it also returns a permission error, you're not rooted. It should ask you at the mobile's display for permission if you're rooted and you are doing that for the first time.
Thx U dude, U R the one

Trouble rooting 3.2 wifi xoom

Hi guys I can't post in the xoom root thread yet so I had to start a new thread. I am following this guide to root my xoom http://forum.xda-developers.com/showthread.php?t=1170760. I had no trouble up until this point
In the command window on your PC type; adb remount
Type; adb push su /system/bin
Type; adb shell
Type; ln -s /system/bin/su /system/xbin/su (this line starts with lower case "L", like llama)
Type; chmod 4755 /system/bin/su
Type; exit
Type; adb push Superuser.apk /system/app
I remounted the xoom but then when I type "adb push su /system/bin" it says "cannot stat "su' no such file or directory" and nothing works after that. Does anyone have a solution?
Update: SOLVED! To anyone else having this problem I figured it out. Make sure the su and superuser apk files are OUTSIDE of the original folder and in the platform tools folder.

Failed to copy to /data using adb push

Hi,
I am trying to push
Code:
$ adb push androidvncserver /data/androidvncserver
failed to copy 'androidvncserver' to '/data/androidvncserver': Permission denied
When I do 'su' in 'adb shell', i get a root prompt , that means I have rooted my device, right?
Code:
$ adb shell
$ su
#
If so, how can I push to /data?
Thank you.
Your default shell is secured - means, when you're executing ADB command without executing something through SU, you're going through the regular permissions.
To enable insecure boot, set ro.secure to 0 in your build.prop. I'm not sure if it's enough, though, or if you need a kernel compiled with security off to take full advantage of insecure adb commands.
You can push the file to sdcard, enter shell, enter su, and in root shell copy the file where you want it to be.
And you're posting in the wrong section. There is Q&A for questions, please move there.

Categories

Resources