Chmod command - Android Q&A, Help & Troubleshooting

What is adb shell chmod command
Sent from my HTC Explorer A310e using xda app-developers app

ri123 said:
What is adb shell chmod command
Sent from my HTC Explorer A310e using xda app-developers app
Click to expand...
Click to collapse
First you have to open a command window in ADB then type:
Code:
adb shell
chmod <numeric premission> <file or directory>
For example once in adb shell:
Code:
chmod 755 superuser.apk
Let me know if you still have questions .
Sent from my SCH-I535 using xda premium

shimp208 said:
First you have to open a command window in ADB then type:
Code:
adb shell
chmod <numeric premission> <file or directory>
For example once in adb shell:
Code:
chmod 755 superuser.apk
Let me know if you still have questions .
Sent from my SCH-I535 using xda premium
Click to expand...
Click to collapse
What does chmod 755mean?
Sent from my HTC Explorer A310e using xda app-developers app

ri123 said:
What does chmod 755mean?
Sent from my HTC Explorer A310e using xda app-developers app
Click to expand...
Click to collapse
The 755 in the chmod command corresponds to how Linux sets file permissions, using a numeric system. In Linux each file or directory has 3 permission Owner (The owner of the file), Group (Others who have access to the file), and Other (Everyone else). Chmod 755 means that the owner has full read, write, and execute privileges while the group has read and execute permissions, and the other group has read and execute permissions. Let me use an analogy, person A (Owner) is the owner of the file so he has full permission do what ever he wants with the file read, write, execute (7). Then say person A is working with person B (Group), but person B doesn't need to make changes to the file so he only needs to be able to read the file and execute the file so he is given read and execute privileges (5). Now person A and person B have a few friends (Other) who want access to the file but Person A and B don't want there friends to be able to change the file just read it and execute it, so they would be granted read and execute privileges (5). When you put all the privileges together you get 755 numeric permission. For more information on how file permissions work in Linux I would recommend taking a look at this guide and this guide.

Related

Terminal 'SU' Command not working

Guys,
When I go into terminal and type 'SU' to use Imo's kernel speedtweaks, I get 'permission denied'...
Any help would be appreciated.
Thanks!
Check your superuser app to make sure it isn't set to deny su permissions to terminal emulator.
Sent from my ADR6400L using XDA App
jwterminator said:
Check your superuser app to make sure it isn't set to deny su permissions to terminal emulator.
Sent from my ADR6400L using XDA App
Click to expand...
Click to collapse
All I have are allowed apps.... I am accessing terminal emulator thru the bamf toolkit which is set to allow.
check to see if su even exists (probably under /system/xbin, but maybe under /system/bin as well).
after you find it, see what the permissions are on it (ls -l -a su)
yareally said:
check to see if su even exists (probably under /system/xbin, but maybe under /system/bin as well).
after you find it, see what the permissions are on it (ls -l -a su)
Click to expand...
Click to collapse
Found it in system\xbin....how do I check permissions? Long press on it only gives me send,move,copy,rename or delete.
Thanks for your help!
tazman19 said:
Found it in system\xbin....how do I check permissions? Long press on it only gives me send,move,copy,rename or delete.
Thanks for your help!
Click to expand...
Click to collapse
open up the terminal emulator command line (if you dont have a terminal emulator, search for one in the market), then type:
ls -l /system/xbin/su
or
busybox -l /system/xbin/su
then paste the results
*just a note for your own reference, linux/unix use forward slashes (/) for directories, not backwards (\) like windows
yareally said:
open up the terminal emulator command line (if you dont have a terminal emulator, search for one in the market), then type:
ls -l /system/xbin/su
or
busybox -l /system/xbin/su
then paste the results
*just a note for your own reference, linux/unix use forward slashes (/) for directories, not backwards (\) like windows
Click to expand...
Click to collapse
Wierd...its saying no such file or directory...but in file manager, its there!
File size is 25.65KB
You are not typing it in all caps are you? Linux is case-sensitive.
if you did the later command, i meant:
busybox ls -l /system/xbin/su
had a typo
they should be the same, unless somehow linking is messed up on your system, so i mentioned doing it both ways, since android has a more stripped down version of ls built into the phone that isn't as great.
like the post before mentioned...no caps.
Beastclaw said:
You are not typing it in all caps are you? Linux is case-sensitive.
Click to expand...
Click to collapse
+1
Make sure your in lower case
Sent from a cellular telephone
Beastclaw said:
You are not typing it in all caps are you? Linux is case-sensitive.
Click to expand...
Click to collapse
+1000000
-rwsr -sr -x root root 26264 2008-08-01 08:00 su
tazman19 said:
+1000000
-rwsr -sr -x root root 26264 2008-08-01 08:00 su
Click to expand...
Click to collapse
Bumping message to front.
jwterminator said:
Check your superuser app to make sure it isn't set to deny su permissions to terminal emulator.
Sent from my ADR6400L using XDA App
Click to expand...
Click to collapse
Thanks a lot! it worked

[GUIDE] Basic Unix/Linux command to use with ADB SHELL

So I have been reading quite a few threads here on XDA, and the one thing I noticed for noobs to linux/unix world is that they are struggling with some basic command once adb shell is gained. I decided to whip out this quick tutorial to help those noobs out to become more of an expert...like me...lol j/k
Here we go:
Prerequisites:
You must know how to invoke a adb shell command already to drop into your phone.
ALL commands in Unix/Linux are case sensitive
For more details, go to this ADB tutorial (very good one): http://forum.xda-developers.com/showthread.php?t=517874
Let's get going:
Once a shell is gained via adb, let's look at some of the basic commands you can do to navigate around the filesystem. Note: you must remove the double-quotes (") for the actual command.
Code:
"cd" = is change directory
to change to any directory, you type: cd dir_name (where dir_name is a full path)
Example: I want to go to /data/local/tmp in my phone, I would do
cd /data/local/tmp <hit ENTER>
You can also use the ".." to go UP one directory.
Example: I'm in /data/local/tmp and I want to go up to /data folder, a command would be: cd ../.. alternatively, if I do cd .. then i'll drop into /data/local folder instead.
Code:
"ls" = list files/directories
to list files/directories within a folder, the command should be:
ls <hit enter> => this will list all NON-HIDDEN file/directories within your CURRENT directory.
ls /data/local/tmp => this will list all NON-HIDDEN file/directories within /data/local/tmp directory.
ls -l => this will list all NON-HIDDEN file/directories within your CURRENT directory, plus additional details. Consider this is like a "Details" view in Windows Explorer.
ls -a => this will list all files/directories (including hidden files) within your CURRENT directory.
ls -la => this will list all files/directories (including hidden files) within your CURRENT directory, plus details.
Code:
"chmod" = change mode
Goes to wikipedia for more details: https://secure.wikimedia.org/wikipedia/en/wiki/Chmod
Most commonly used modes on android phones are:
"755" or "777".
So if you have a root.sh shell script that you downloaded from XDA, and uploaded to your phone and try to execute it with ./root.sh and it said "Permission denied". That means your script does not have the execute permission. You need to do:
chmod 755 root.sh <hit enter>
[B]IMPORTANT: There is *NO* negative sign (-) in front of the mode bit. So it is NOT chmod -755 root.sh[/B]
If you get a "File or directory not found" error, which means you are chmod-ing a file that doesn't exist in your current directory. To execute a chmod on root.sh in /data/local/tmp you do:
chmod 755 /data/local/tmp/root.sh
If you want to chmod an ENTIRE DIRECTORY and ALL files underneath it you do:
chmod -R 755 /data/local/tmp => this will set /data/local/tmp and ALL files/folders underneath it to be 755.
Code:
"chown" = change ownership
Go to wikipedia for details: https://secure.wikimedia.org/wikipedia/en/wiki/Chown
Most common used chown for android is: "root:root" or "root:shell"
Example: if you want to change ownership of root.sh to root:shell then you do:
chown root:shell root.sh
NOTE: the -R (recursive) option is also available for chown.
chown -R root:shell /data/local/tmp
Code:
"pwd" = print working directory
so when you are within a directory and you want to know which directory you are in, then you issue the command:
pwd <hit enter>
The system will reply back with the currently directory you are in.
I'll try to add more if I think of anything else useful, or if you have suggestions, please feel free to add.
so what does it mean to add adb to your path? thats holding me back from temp rooting on my mac. Im a total adb noob clearly.
hockey4life0099 said:
so what does it mean to add adb to your path? thats holding me back from temp rooting on my mac. Im a total adb noob clearly.
Click to expand...
Click to collapse
The easiest way to explain it is that you can run ADB from anywhere...do a search and you can find a more detailed (and more proper) explanation and directions on how to set it up.
hockey4life0099 said:
so what does it mean to add adb to your path? thats holding me back from temp rooting on my mac. Im a total adb noob clearly.
Click to expand...
Click to collapse
What OS are you using?
vboyz103 said:
What OS are you using?
Click to expand...
Click to collapse
mac
______________
hockey4life0099 said:
mac
______________
Click to expand...
Click to collapse
Like I said, do a search on XDA...there's a great guide on how to set up ADB properly. I'll link to it tomorrow when I get on the computer.
-- Sent from my 3VO Shooter --
hockey4life0099 said:
mac
______________
Click to expand...
Click to collapse
If you use mac, open a Terminal, and you should be at your home directory and type:
nano ~/.profile
if the .profile doesn't exist yet, then you'll see an empty.
Put this into the file
PATH=$PATH:/path/to/your/android/platform-tools
export PATH
save and exit out of Nano, and type:
source ~/.profile
then after this type adb and if adb is in your PATH then you see adb help.
Overview Of Permissions via ADB SHELL
Example = drwxrwxrwx
To Check Permission at anytime in ADB just Type:
ls -l
The First character defines the Directory, Link, Binary.
Below are some examples
Example = d---------
d = Directory
l = Link
b = Binary
The next 9 characters define the file permissions. These permissions are
given in groups of 3 each.
The first 3 characters are the permissions for the owner of the file or directory.
Example = -rwx------
The next 3 are permissions for the group that the file is owned by.
Example = ----rwx---
The final 3 characters define the access permissions for everyone not part of the group.
Example = -------rwx
There are 3 possible attributes that make up file access permissions.
r - Read permission. Whether the file may be read. In the case of a
directory, this would mean the ability to list the contents of the
directory.
w - Write permission. Whether the file may be written to or modified. For
a directory, this defines whether you can make any changes to the contents
of the directory. If write permission is not set then you will not be able
to delete, rename or create a file.
x - Execute permission. Whether the file may be executed. In the case of a
directory, this attribute decides whether you have permission to enter,
run a search through that directory or execute some program from that
directory
In addition to the file permission, you can also modify the owner and
group of the file. The chown program is used here and its syntax is very
simple. You need to be the owner of a file or root to do this.
Understanding Owner Permissions:
The first command is for owner ID, the Second Command is for Group ID.
exp. root.root ( First Root is owner, Second Root is Group ).
Chmod 644 some file, Like Build.prop For testing & then Veiw the Resulted Changes!
Refer to the table below as a quick reference.
Command Line for Both would look like this
chmod 644 build.prop = -rw-r--r--
\/
Chmod Guide
0 - ---
1 - --x
2 - -w-
3 - -wx
4 - r--
5 - r-x
6 - rw-
7 - rwx
SH Chown Guide
\/
chown root.root build.prop
root.root = Root
root.shell = Shell
Busybox SH Chown Guide
\/
chown 0.0 build.prop
0.0 = Root
0.2000 = Shell
I'll update the chmod with more with More Complex Commands Later
Side Note:Always set owner ( chown ) before Setting Permissions ( Chmod )!
Hope this Clears up things & is Helpful to everyone
~Eugene373​
Add adb to your path in Windows.
As has been explained above all it does is allowing your adb to be called out from any location.
To set it in windows you will need to add path to your adb.exe file to your PATH in widows XP or CLASSPATH in windows7.
You can find it in start->contro panel->system->advanced.
There is a tab called "Inviromental Variables".
Click on that tab and new window will pop up. New window has 2 field in it. We are interested in bottom field called "System variables".
Windows XP user should look for line with variable "Path".
Click that line and choose edit below. New pop up will apear and you can edit path line in there. You should add path to your adb.exe to that line.
Example.
I did install windows sdk in c:\android\android-sdx-windows so my adb.exe file is in that folder. I did add path to that folder in "Paht" line of system variables. Add path to your adb.exe after semicolon.
;c:\Location\of folder\where you have\adb exe file\
Save changes, apply them. Now you can use call for adb commands from any location.
Widows 7 users.
Same changed need to be appied as for Windows XP.
There is only one difference that that path in Inviromental variables in windows7 is called "CLASSPATH".
Rest is same. Just add the path to folder containing your adb.exe file to CLASSPATH line and you would be able to use adb in any location.
Hope this make sense and will help.
My mac keeps sayin no device but I can access adb from anywhere basically its in my path but won't pick up my phone
Sent from my PG86100 using XDA Premium App
snoopy1e11 said:
My mac keeps sayin no device but I can access adb from anywhere basically its in my path but won't pick up my phone
Sent from my PG86100 using XDA Premium App
Click to expand...
Click to collapse
Make sure your phone is in debugging mode.
ADB won't see phone if debugging is not enabled.
It is on
Sent from my PG86100 using XDA Premium App
I'm a windows user.
Can't think of anything else.
Sorry.
agat63 said:
Make sure your phone is in debugging mode.
ADB won't see phone if debugging is not enabled.
Click to expand...
Click to collapse
If you have USB debugging turned on, you should see a triangle with exclamation mark on task bar. Secondly, try to do this:
adb kill-server => kill off current server first
then
sudo adb devices => u need to enter password
Basically, you are running adb with escalated privilege, sometimes it needs root access.
This is Wat I got
Sent from my PG86100 using XDA Premium App
snoopy1e11 said:
This is Wat I got
Sent from my PG86100 using XDA Premium App
Click to expand...
Click to collapse
hmmm interesting...just wondering if you have your device turned on to be disk usage instead of just Charge Only?
Check on your desktop to see if you SD card had mounted, not sure if it makes a difference but worth a try. Another thought is that maybe your USB port doesn't work?? Did you check your phone to see if you have a triangle with exclamation mark in it on the task bar? (to the left)
Also, try it on a different computer if u can, and if it still doesn't work, afraid urs is defective.
I really appreciate ur help I re did the sudo command and hit "adb devices connect" and my device popped up
Sent from my PG86100 using XDA Premium App
snoopy1e11 said:
I really appreciate ur help I re did the sudo command and hit "adb devices connect" and my device popped up
Sent from my PG86100 using XDA Premium App
Click to expand...
Click to collapse
Ha, interesting cuz I never have to issue that command. Good to know you got it to work.

[Q]Root Explorer Multiple Permissions how to?

I was wondering how you can change the file permissions for several files at once in root explorer? I copied the media/audio/ folder from another cm7 build to neutrino and moved all the files to the correct folders. Now there are so many files, i'de like to change multiple file permissions at once.
the easiest way is to use terminal emulator or adb shell, su, then do "chmod 755 *" for permission "rwxr-xr-x" or "chmod 644 *" for permission "rw-r--r--". The permission will apply to all files since wildcard "*" is used here.
You would probably have more luck using a terminal and chmod.
http://www.manpagez.com/man/1/chmod/
Generally it would be something like so:
chmod augo+-rwx <file name or wildcard>
a = all (owner, groups, other)
u = user or owner
g = groups
o = other
+ to add permissions, - to remove them
r = read
w = write
x = execute
Edit:
I'm way too slow...
sspa said:
the easiest way is to use terminal emulator or adb shell, su, then do "chmod 755 *" for permission "rwxr-xr-x" or "chmod 644 *" for permission "rw-r--r--". The permission will apply to all files since wildcard "*" is used here.
Click to expand...
Click to collapse
Your answers gave me idea to use chown through adb shell the same way. And it works! Thanks all.
P.S. Can't understand why no one famous root file managers can't do batch and recursive chown/chmod.
igenid said:
P.S. Can't understand why no one famous root file managers can't do batch and recursive chown/chmod.
Click to expand...
Click to collapse
Hello,
Sorry it's late answer, but was the same problem of you...I disocover that "Total Commander" and it do it perfect.
Thanks to all
Actually Total Commander still does not do it. Change a main directory to a specific user and hit recursively, nothing happens down the directory tree. It is only to change the date recursively.

[q] how to push files?

i dont know if the real term is "PUSH" when you want to replace the mms.apk !! wanna ask sir how i can change the default messaging app in my android thanks for the answer
You habe to replace the Mms.apk in /system/app on your phone. To do so you need a file explorer with root privileges that is able to remount the system partition with read write option(normally it's mounted readonly). E.g. root browser or es file explorer
Sent from my Nexus 4 using xda app-developers app
u could also push via adb which is my preferred method or put your desired app in a flashable zip,flash it in recovery,reboot,all done,no need to mess with explorer apps or setting permissions as it does it for you
use adb shell from terminal or command prompt:
1. adb push path:\mms.apk /system/app
2. adb shell
3. cd /system/app
4. su
5. chmod 644 mms.apk
6. chown root:root mms.apk

how can fix adb push permision deny

hi
i need to push a file with adb
but adb push give me permision deny
how can fix this?
my device is rooted but adb show me device not rooted!
Is USB Debugging on?
yes it's on
amir_n71 said:
yes it's on
Click to expand...
Click to collapse
In some rom adb permission isn't root by default. I think it's a line in default.prop that enable root in adb. Something like
ro.adb.secure = 0
if you don't want to edit that file just push file to sdcard or temporary folder then use adb shell (with root) to copy that file to proper location.
but 2 days ago adb work like acharm in this rom!
amir_n71 said:
but 2 days ago adb work like acharm in this rom!
Click to expand...
Click to collapse
That's strange. Maybe in your rom adb push works only when file doesn't exist.
no. i push framework-res.apk 5 days ago & it work! framework-res.apk is exist already
but i test this file again & permision deny!
How about su before the command? Or adb remount, to get write access?
Sent from my LG-P760 using xda app-developers app
I have the same problem too and remounting the adb doesn't solve it.
I'm still searching for a fix. I can only pull but not push.
If y'all are on a stock rom, then you can't push anything directly into the system (unless your bootloader is unlocked & you modify the boot.img). I use the following mount command
mount -o remount /system
First push the file to the sdcard
adb push blablabla /sdcard
then adb shell it to the correct location.
It's a lot of bs but it's the only way I got it to work with stock.
Here's an example of a batch script I made
Code:
adb push LGSystemUI.apk /sdcard/
adb shell su -c "mount -o remount /system"
adb shell su -c "cp /sdcard/LGSystemUI.apk /system/app/"
adb shell su -c "chmod 644 /system/app/LGSystemUI.apk"
adb shell su -c "killall com.android.systemui"
Sent from my LGMS769 using XDA Premium 4 mobile app

Categories

Resources