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.

460 questions
5
votes
4 answers

Force Close an app programmatically

I need to make an application that can programmatically do what the force stop button does to applications. (I am using root permissions) I have tried this code: private void killApp(){ try { int pid = getPid(com.XXX); if(pid !=…
SamJ
  • 413
  • 1
  • 4
  • 18
5
votes
3 answers

Running fabric scripts as root

I am trying to use fabric to automate some administrative work that I am doing on a couple of servers. The general flow is the following: SSH with local user run: sudo su - to become root (providing local user password again) Do the work as root…
Marin
  • 1,268
  • 12
  • 7
5
votes
4 answers

Android regular user login loses group information when su to another user in an ssh session

What I'm doing: I've built GNU emacs for native use on an phone. I run emacs in daemon mode on the phone, so I connect to it anytime with emacsclient, to continue working with regular files, run processes, etc. When logging in from the terminal on…
白い熊
  • 281
  • 2
  • 6
5
votes
4 answers

Is it possible to run a shell command as root with only the su binary and no SuperSU or Superuser apk installed?

I have an Android phone that has only su binary installed and it works, meaning I can adb shell into the phone and run an 'su' command and I will be root. When I try to run a command via code, it doesn't seem to work no matter which way I try to…
brianestey
  • 8,202
  • 5
  • 33
  • 48
5
votes
1 answer

SSH Error - standard in must be a TTY

I'm trying to run the following command: ssh -i FILENAME.pem ec2-user@ec2-00-000-00-00.eu-west-1.compute.amazonaws.com su --session-command="./update.sh" I keep getting the error message: standard in must be a tty How can I SSH on to the server…
ajtrichards
  • 29,723
  • 13
  • 94
  • 101
4
votes
2 answers

How can I execute commands as another user with their .bash_profile instead of the current user's?

I want to run a command as a not-root user in a startup script (rc.local). The command I want to execute is actually an alias in the non-root user's .bash_profile. I have tried to use su - myuser -c aliased_cmd but this doesn't work. If I simply…
Jesse
  • 1,117
  • 10
  • 9
4
votes
1 answer

Running an app with root permission in Android

Do you know how to run an app in Android with root permission? I used the following snippet but the root permission is only granted to generated process, not the app itself. process = Runtime.getRuntime().exec("su")
tuan
  • 433
  • 8
  • 17
4
votes
1 answer

Change user (su) via Python script (pexpect, popen...)

I am running a Python script with user1 and in this script I need to move a file in a folder for which I don't have access. The folder is owned by user2. What I want to do is : - change from user1 to user2 using su - user2 - enter the…
Edouard Cuny
  • 1,169
  • 1
  • 10
  • 10
4
votes
1 answer

Cannot run program "su" on rooted device

I have a rooted phone running Android N (AOSP build). I am trying to get root permissions from my app but it keeps getting permission denied. Here is what I am trying: java.lang.Process p = runtime.exec("su"); DataOutputStream…
doomguy
  • 401
  • 10
  • 26
4
votes
1 answer

How do you start Python Paramiko SFTP with sudo?

Using the standard client.open_sftp() handle gives me SFTP controls but without sudo/root permissions, any sort of /etc/** files can't be edited. I have a user that has passwordless sudo access, I figured I could maybe start off with sudo su and…
Rezen
  • 435
  • 1
  • 8
  • 23
4
votes
1 answer

Using JAVA intercepting Jsch prompt for entering password in UNIX shell

I am trying to run shell command using jsch using java program. Command needs sudo access to get executed. Following is my code sample. String command1="sudo restart oraserv"; java.util.Properties config = new java.util.Properties(); …
Nomad
  • 1,019
  • 4
  • 16
  • 30
4
votes
1 answer

Error on neo4j server start on arch linux

I have an arch linux setup and installed neo4j through the arch user repository (yaourt -S neo4j), and I'm able to run the web console fine (sudo neo4j console with seemingly normal output and full functionality), however when trying to start the…
4
votes
3 answers

Disable supersu permission dialog

Is it possible to disable the "grant/deny" popup dialog when my app needs to perform tasks that require root access? I have full control of the device the app will run on (internal project), the device is rooted and it has supersu 2.x app. This…
Misterer
  • 51
  • 1
  • 4
4
votes
2 answers

Emulating sudo's behaviour with su

I'm trying to write a wrapper around su to make it more like sudo, so that su_wrapper foo bar baz == su -c "foo bar baz". However, I'm not sure how to approach this problem. I came up with this: su_wrapper () { su -c "$@" } However, in the above,…
user2064000
3
votes
0 answers

Emacs hangs when using tramp with su

after reinstalling my system, I discovered that the emacs tramp isn't working..;. Here is what exactly happens : I type in C-x C-f /su:root@localhost: Here emacs asks for my password, which I provide. It then hangs, showing the above string…