• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

How to give RW permissions to file in android using pc commandline

kirankvb

Newbie
Jul 28, 2014
22
0
I am going to create zip file, so in that, I need to change the file permission to rw-r-r and I want the command line in order to type in terminal
I know how to change using GUI but I want using command line
I copied some files in the "system/" directory and want to give some permissions to it
can anyone help me
 
so if I want to copy a file to /system which command I have to type in command prompt
i want to create a script in that i want to copy some files from computer to android system and changing the read/write permissions
If you know anything about that just help me

You'll need to have root permission to do this. /system isn't accessible to normal users, so your phone must be rooted.
Assuming this is the case, then you'll use a command similar to this

Code:
adb push Settings.apk /system/apps/

https://www.droidviews.com/push-pull-files-android-using-adb-commands/
 
Upvote 0
If you really want to get comfortable using CLI commands instead of relying on a GUI, it would be very beneficial to learn some fundamentals. Using the chmod command to change permissions might appear to be daunting in the beginning but once you take the time to absorb the basics behind it, things become much more logical. Try reading through this primer a few times:
https://www.digitalocean.com/community/tutorials/an-introduction-to-linux-permissions
Keep in mind using chmod that you have just these items to focus on:
1) three values - 4, 2, and 1
2) three permissions - read (r), write (w), and execute (x)
3) three classes - user, group, and other
So that, "rw-r-r" you had in your initial posting is, in a formal setting, incorrect syntax. At minimum you always should have at least nine total, so it should be rw-r--r-- (with the - signifying that permission is not enabled. Plus it's always the same order -- read/write/execute and user/group/other -- those never change.) Getting back to your original query, it would be 644, or to break it down:
owner group other
r(4) w(2) x(-)
r(4) w(-) x(-)
r(4) w(-) x(-)

Since your question has already been answered, the primary reason I'm even replying is in this instance you'll be much better off in the long-term if you're familiar with permissions. It's not to dissuade you from asking for help or to be dismissive but there are some seriously hostile souls out in the Internet. Asking for a string of code on a public forum can result in a some posting with what appears to be safe but in actuality could also include a command that can be very problematic. That won't happen here in AF of course ;-) but elsewhere there's no shortage of examples were someone asks for a help and a reply contains a command that deletes everything on the drive.
 
  • Like
Reactions: kirankvb
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones