Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My phone is rooted CM7 and Superuser.apk has Connectbot in the allowed list. Titanium backup reports that it has root access, to prove that I actually have root working. I seem to remember being able to run commands in Connectbot as root in the past.

But now, I go into Connectbot → Local, and try to run a command using sudo, and it just says "permission denied". No pop-up or anything. Same for the Terminal Emulator app. How do I run commands as root?

share|improve this question
up vote 8 down vote accepted

The su binary works just like it does on Linux; it runs all commands that follow as root until you type exit (or terminate the process, etc.). sudo <command> essentially does:


Android doesn't normally include sudo, so If you wish to launch commands like you would with sudo, the syntax is as follows:

su -c "[command_1;command_2;...;command_N]"

For example, to get a list of installed packages in "root" mode, you can either do

$ su
# pm list packages
# ........ <listing of packages scrolls down> ......
# exit


$ su -c "pm list packages;exit"
share|improve this answer
Oh. If I use su by itself, it works. Connectbot is granted superuser permissions and then I can do stuff as root. Does sudo ever work, then? – endolith Mar 26 '12 at 15:06
Linux also have su binary.. so, don't say su as android equivalent of sudo. – Evil Angel Mar 26 '12 at 16:02
sudo isn't installed on Android by default; sudo was written to give people the ability to access certain commands (via configuration) instead of using su to log in as root all the time. su is the more important command when you don't have uid 0 at all on your device. – Broam Mar 26 '12 at 16:54
@SachinShekhar Feel free to correct my answer with proper verbiage. – Chahk Mar 26 '12 at 17:23
For some reason, this is not working for me in CYM11 (inside an app). For su -c "pm..." I get Permission denied, and the app appears with a Deny in the logs. I have another apps with Allow, though. No Toast appeared asking for permissions... Any idea? – Luis A. Florit Sep 6 '14 at 22:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.