How to Write Permission to System/app in Android - android

how to give write permission to system/app folder
i have rooted my android device
i want to download the app and install in system/app folder
Process p = Runtime.getRuntime().exec( "su" );
i had tried this command it ask for user permission and then it throws exception
system/app is read only file system

First go to shell using
adb shell
Then remount the system folder as writable using following commands
$ su
# mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
Then change the permission of system folder to Read, Write and Execute using
# chmod 777 /system/app

Just type in your android device terminal
su
and then
chmod 777 system/app
su- grants you superuser permission
and chmod 777 file, change the permissions of the file to read, write, and execute..

Try adb remount in terminal.
If you want to do it from the device shell, see this question on how to remount the file system with write permission.

Related

adb run-as copy file

I have debbugable app, and I need to copy file to phone, and back after. I use this command and receive error.
adb shell run-as app cp /data/data/app/shared_prefs/app_preferences.xml /storage/emulated/0
cp: /storage/emulated/0/app_preferences.xml: Operation not permitted
I tryied to edit file
adb shell run-as app "echo test > /data/user/0/app/shared_prefs/app_preferences.xml"
/system/bin/sh: can't create /data/data/app/shared_prefs/app_preferences.xml: Permission denied
But if I try
adb shell
run-as app
echo test > /data/user/0/app/shared_prefs/app_preferences.xml
This way I able to edit file, but cp not. Also via Android Studio I can save and upload file.
In total, how to edit in one command or copy file?

How to copy an apk into /system/ folder using adb?

While using android debug bridge remount, it changes the system folder to r/w, but
as soon as the user tries to copy some file using android debug bridge to the system folder it changes to read-only
If the device is not rooted, you cannot copy anything to the System or Data partitions.
With root do the following commands in a command prompt or linux shell and all should be fine:
adb push fileName /data/local/tmp
adb shell
su
mount -o remount, rw /system
cp /data/local/tmp/fileName /system/folderOfYourChoise
chmod 644 (if its an apk and you want the system to use it as a system app)
exit (exits the su shell)
exit (exits the adb shell)
adb reboot (to apply and see changes on the device)

how to convert app to system app ?

How do install a *.apk from adb command line?
First I tried to cp the *.apk from /sdcard/backups/apps to /system/app (after rw mounting the file system of course)
I did successfully move it to /system/app but the *apk was not "installed"
I used this code :-
**
adb shell
su
mount -o rw,remount /system
adb shell
su
cd /sdcard
mv com.ogp.gpstoggler-1.apk /system/priv-app
finally after I write
chown 644 /system/priv-app/com.ogp.gpstoggler-1.apk
and press enter the result is
Unable to open /system/priv-app/com.ogp.gpstoggler-1.apk: No such file or direc
tory***
how to fix this ? thank you ?
Instead of using "mv" use "cp" to copy it to system/priv-app folder.
Ensure it is in the priv-app folder using "ls"
use chmod 777 to give it privileges
Ensure it has the correct privileges using "ls -l"
use "adb reboot" to have the system install the application.
Edit
One thing I forgot to note - if you go into the system/priv-app folder and you see that all the other APK's are in their own folders, you might also have to create a folder for your apk.
mkdir system/priv-app/app_name
cp app_name.apk system/priv-app/app_name
cd system/priv-app/app_name
chmod 777 system/priv-app/app_name/app_name.apk
adb reboot

Can not access android /data folder

I want to get the /data/data/packagename/databases/test.db, but i can not get it "Permission denied".
I use adb shell to access data folder, it shows:
$ sudo adb shell
$ cd data
$ ls
ls: can't open '.': Permission denied
why?? I can access /system folder
You need to be a root user to do that.
First your phone should be rooted, you can use https://www.kingoapp.com/ for that.
Next, you should modify the permission of your app access, to do so you have to :
Locate your adb.exe folder (you can find it in your sdk folders)
Right click
open cmd here
Type:
adb shell
su
chmod 777 /data /data/data /data/data/yourapp
Good luck

Can I have a write permission in android Read-only file system?

Whenever I try to update framework-res.apk on system/framework folder on my G1 it gives me an error:
failed to copy 'framework-res.apk' to '/system/framework/framework-res.apk': Read-only file system
Then I tried to mount it with read write permission with this line:
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3
But it says Usage: mount [-r] [-w] [-o options] [-t type] device directory
And I read on forum that you have to access with su command But whenever I try to hit command su it says permission denied.
try visionary for rooting your phone (http://android.modaco.com/content/software/320350/19-nov-r14-visionary-one-click-root/) and then su would work for you.

Categories

Resources