Questions tagged [su]

GENERAL SU SUPPORT IS OFF-TOPIC. Support questions may be asked on https://superuser.com. su is a utility to run a shell or other command as another user (root by default).

su is a Unix/Linux utility that runs a shell or a specified command as another user. By default, the other user is root, and su, with , is one of the two common ways of obtaining administrator privileges. Calling su usually requires typing the target user's password.

su originally stood for “super user” (it was only for running a root shell), and became later known as “substitute user” (or “switch user” or a number of similar backronyms) when it started accepting the target user name as an argument.

For system administration questions, see the su tag on Super User (for non-professionals), Server Fault (for professionals), or Unix & Linux.

437 questions
12
votes
3 answers

Read command output inside su process

firstly I will present my situation. I need to execute "su" command in my android app and it works well. Then I need to execute "ls" command and read the output. I'm doing it by getting the output stream from the "su" process and writing my command…
glodos
  • 1,123
  • 3
  • 11
  • 21
11
votes
2 answers

getting error while using "su" command

I try to make batch file to run adb commands. I want to use su -c, but I get the error: su: invalid uid/gid '-c'. I saw somewhere that my su version doesn't support -c, how can I enable this?
yehonatan
  • 193
  • 1
  • 2
  • 11
10
votes
1 answer

Root privileges for an android application (Complete app. Not just few commands)

Question : How to execute one complete app with root previleges (not just few commands)? Scenario : I am working on a rooted android device. In an android app, I need to play the H.264 stream received through eth0. I need root privileges to open…
mk..
  • 15,357
  • 13
  • 60
  • 96
10
votes
1 answer

JSCH sudo su command "tty" error

Java - Jsch sudo command. I am using Jsch and my task is to login to server and run command as following sudo su - bumboo Using following code i am successfully able to connect but when i try to run command it gives me error sudo: sorry, you must…
d-man
  • 53,999
  • 81
  • 200
  • 285
10
votes
3 answers

How does su work on android? And what are the pre-requisites for it to work? What is rooting on Android?

Possible Duplicate : what does the su mean: process = Runtime.getRuntime().exec("su"); I am tired trying all the different things yet i am still unsuccessful in understanding when will su work. What is rooting a device in Android? Someone please…
mk..
  • 15,357
  • 13
  • 60
  • 96
9
votes
3 answers

Rooted but su says "Permission denied"

I have this "old" Lenovo A2107 tablet which I rooted years ago (using a download from http://androidforums.com/threads/a2107-root-mods-and-rom-discussion.661261/, tho running its root.bat script by hand from my GNU/Linux machine) and that worked…
Stefan
  • 26,706
  • 4
  • 42
  • 75
9
votes
1 answer

msysGit sudo-like command

If we open msysgit as administrator, we can use it as if we were root. However, it is often easier to open without administrator privileges. For example, for administrator privileges, you often have to go to Windows Explorer, the Start menu/screen,…
trysis
  • 7,124
  • 12
  • 47
  • 74
8
votes
1 answer

Checking sudo in Bash (script with if statements)

I've been working with bash for not more than 6 hours, and now I'm trying to create a menu that allows you to do some "fun" stuff :D. My problem is with the if statement that check if you're in sudo mode. I want to have 3 conditions: If I execute…
Patryk
  • 83
  • 1
  • 4
7
votes
1 answer

scp file to different user in the remote server from local

generally, i login to a server xyz.com using my login credentials(myuserid@xyz.com), my home = /home/user/myuserid/ after login, i do "su - someuser" to access the files. i would like to copy a file from local machine to a directory in someuser…
sandeep vn
  • 83
  • 1
  • 1
  • 3
7
votes
1 answer

Android : programmatically copying apk to /system/app

I am trying to install a system app from my java code, and so far, I haven't had any success. Following is what I have done so far: My device is rooted. My "installer" app is installed as a system app. (copied it manually to /system/app) I have…
Chaitanya
  • 2,009
  • 4
  • 25
  • 31
6
votes
5 answers

Getting a PID from a Background Process Run as Another User

Getting a background process ID is easy to do from the prompt by going: $ my_daemon & $ echo $! But what if I want to run it as a different user like: su - joe -c "/path/to/my_daemon &;" Now how can I capture the PID of my_daemon?
Dex
  • 11,863
  • 15
  • 65
  • 88
6
votes
6 answers

su and sudo in a shell script

There is a shell script (/bin/sh, not bash) that requires root permissions for execution. If it is ran by a normal user it should ask user a password to get root access and re-run itself. Now it uses the following code: if [ $(id -u) -ne 0 ]; then…
zserge
  • 2,033
  • 1
  • 31
  • 37
6
votes
2 answers

How to define environment variable in input command of su

This command has an empty output. su user -c "ABC=abc;echo $ABC" Any idea, how can I define a variable in the input command?
Attila Zobolyak
  • 689
  • 1
  • 10
  • 15
6
votes
4 answers

Android- performing su commands programatically does not work

I need my app to perform some su commands programatically (phone is rooted). When done using adb, the commands work. For instance: su -c "mkdir /sdcard/testdir" creates a directory called "testdir" in /sdcard. When I call: p =…
LoneDuck
  • 1,722
  • 1
  • 19
  • 26
6
votes
3 answers

Root detection methodology in android which cannot be bypassed

I know that running an app which possess sensitive information on a rooted device is not secure at all. So developers usually do root detection in such cases and if the device is found rooted,then that app won't get installed. everything is ok. The…
Anonymous Platypus
  • 1,101
  • 4
  • 17
  • 43
1
2
3
29 30