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
0
votes
1 answer

Ruby RVM under another user from Bash script

What is the best way to launch ruby script under another user via su command and from another script? I have a bash script with the following command for launching unicorn: sudo -u unicornuser sh -l -c "bundle exec unicorn_rails -E production…
odiszapc
  • 4,089
  • 2
  • 27
  • 42
0
votes
2 answers

SuperUser command outputs in Android

I am trying to use SuperUser commands to create a list of files that are in a certain location. I am using the method laid out in this post: Android using Super User Permissions ? allowing access My specific code looks like this: try { …
easycheese
  • 5,859
  • 10
  • 53
  • 87
0
votes
3 answers

su without password within a script

I'm sure this question has been answered before, but I can't find an answer that I like. I would like to write a shell script that executes a very specific script as another user (I want anyone to be able to start postgres as the postgres user). …
prauchfuss
  • 1,930
  • 3
  • 17
  • 20
0
votes
3 answers

Linux su password

I want to change the user in one command line with su echo password | su user But this is not working. Is there a other possibility? best wishes
Chuck
  • 139
  • 2
  • 3
  • 13
0
votes
1 answer

Does the expect command work after an su is executed in the script?

Does the expect command work after an su is executed in the script? Does expect work by emulating the feeding of key strokes to the terminal?
vfclists
  • 19,193
  • 21
  • 73
  • 92
-1
votes
2 answers

PHP - execute command as root

I'm trying to execute a command as su from php. When I put the command in terminal or with php /var/www/script.php it works perfect, but when I open script.php through browser it returns - sudo: no tty present and no askpass program specified…
user997379
  • 25
  • 1
  • 5
-1
votes
1 answer

Android Studio execute su shell and use it multible times to avoid "su" toast

I`m currently using the this code to send su commands: private void execShellCmd(String cmd) { try { Process process = Runtime.getRuntime().exec("su"); OutputStream outputStream = process.getOutputStream(); …
luki1001
  • 1
  • 1
-1
votes
2 answers

while creating user for my postgreSQL database. I get error su : The term 'su' is not recognized

I run the following command in my windows powerShell su postgres su : The term 'su' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the…
user10184547
-1
votes
1 answer

root undoing previous changes after sudo su user

I am having a hard time with root whenever i run sudo su and then nano ~/.zshrc, edit my file to add PATHs followed by a source ~/.zshrc, it works just fine. That until i run sudo su myuser to go back to my default user. When i do that all my…
klferreira
  • 322
  • 1
  • 4
  • 11
-1
votes
1 answer

su commands in a script executed as root seem inconsistent

I'm trying to understand how to run commands from my user account in a script with root privileges. I've got this test script and the output is confusing me. ~$ cat test.sh output: #!/usr/bin/bash su -c "whoami" user su -c "echo $HOME" user ~$ sudo…
-1
votes
1 answer

Doing sudo su with ssh on a remote server not working

This seems to be a popular question on stackoverflow but nothing seems to be working for me I will explain my problems first and then go the the solutions I have tried What I need to do is to ssh to serverB from serverA. for this I have set up an…
Shubham Khatri
  • 270,417
  • 55
  • 406
  • 400
-1
votes
1 answer

How to switch user in bat file when you login to standard user and then su to other user on ssh to linux server?

i am doing automation the process by bat file. putty.exe -ssh bhavepatel@10.10.178.140 -pw Winter34! -m C:\Users\BHAVEPATEL\Desktop\tel\tel.txt -t In tel.txt file , i want to change the directory ans switch the user.Please see below code in…
bob3409
  • 33
  • 6
-1
votes
1 answer

Can't access super user in ubuntu

I am trying to login to my Ubuntu terminal as super user, but terminal says "Cannot execute :No such file or directory" output from terminal : gowtham@gowtham:~$ sudo su [sudo] password for gowtham: Cannot execute gowtham: No such file or…
Gowtham
  • 39
  • 1
  • 7
-1
votes
2 answers

Ansible sx su - impersonation

Does anybody have an idea how to execute a playbook on a RHEL machine with sx su - impersonation? Ansible only provides sudo out of the box but we cannot use sudo as we are using Boks ssh. Does anybody have an idea how to tackle this?
Marco van Dam
  • 97
  • 1
  • 2
  • 8
-1
votes
1 answer

clearing multiple apps' data android

I'm able to clear a single package name's data through this snippet. However, i want it to handle more than one package names. in other words, it should clear two more package names' data private…
MaggotSauceYumYum
  • 402
  • 1
  • 5
  • 23