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
2 answers

How to run command in su mode in bash script?

I need to run these two commands : ulimit -s 1024 echo 120000 > /proc/sys/kernel/threads-max The first one can be run just in user mode (not using sudo or su) and the second can only be run in su mode. I want to write a bash script that let me run…
moorara
  • 3,897
  • 10
  • 47
  • 60
0
votes
1 answer

how to pass a password on a command line while using su

I am trying to switch the user in pC. I don't want to type the password after prompt. Instead I want to pass it while doing a login. For example- $su loolu oohlala How to pass the password in the su command.
dexterous
  • 6,422
  • 12
  • 51
  • 99
0
votes
1 answer

How to use su command from within ssh command in unix shell script

My Requirement is to login into the remote machine and make some folders for this I am planning to take username and pwd as input from the user and try to make automate shell script. 1.)I used the following code to ssh into the machine and give the…
user1709952
  • 169
  • 2
  • 7
  • 21
0
votes
1 answer

how to create a folder in /system with root in my app

Hi in my Filemanager i want to add an Option to create Folder in /system directory. Ive tried this to add to my code. It doesnt work. What did I wrong? File dir = new File(path + name); Runtime.getRuntime().exec("su -c \"mount -orw,remount…
df1e
  • 50
  • 1
  • 9
0
votes
3 answers

Java switch user using su on linux

I am writing a java program dor Oracle EBS that needs to switch user because of specific permissions defined on an user different than applmgr. The approach we're taking is to have a java class that will switch user on a separate session and then…
fdalsotto
  • 19
  • 2
0
votes
1 answer

Running a login shell using sudo inside a shell script on Mac OSX

I am trying to run some bash scripts that we wrote on Linux on Mac OS X Mountain Lion. The script performs a #!/bin/bash sudo su -l << EOF echo $HOME #execute command that is only on the path of EOF No I am running the script…
aorticDefiance
  • 115
  • 1
  • 10
0
votes
3 answers

Security of su root in bash script

I have a bash script which runs commands that require root privileges. I'm trying to decide between setting "su root" at the start of the script, or running each command prefixed with "sudo". What are the pros and cons of these methods, and which is…
Nathan
  • 73,987
  • 14
  • 40
  • 69
0
votes
2 answers

Confused on sudo vs su and running scripts

When I do sudo su - john I become user john without asking for a password. But when I do: sudo su - john /usr/share/script_to_run.pl I am asked for a password. Same also for sudo -u john /usr/share/script_to_run.pl Why? What am I doing wrong here?
Cratylus
  • 52,998
  • 69
  • 209
  • 339
0
votes
1 answer

missing file operand cp after su

I run this command on ubuntu: su - test -c cp /home/test/toto.txt /home/test/dir But I have this error! cp: missing file operand anyone has an idea about the problem? thank you
ATEF CHAREF
  • 387
  • 5
  • 8
  • 18
0
votes
1 answer

Android: Execute "su" not working in my device/emulator

I am stuck with executing a write command in the code: Process sh = Runtime.getRuntime().exec("su -c [command]"); OutputStream os = sh.getOutputStream(); String filePath =…
0
votes
1 answer

Su v/s Sudo on Mac

I was trying to create a symlink to the sublime exe file from the sublime package to usr/bin using su: su ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/bin/ but it gave me an error: su: Sorry It seems to work when I…
Siddhartha
  • 4,296
  • 6
  • 44
  • 65
0
votes
2 answers

Permissions difference between sudo su and just being the user? (Specifically with git)

I'm having a weird permissions issue. It seems that being logged in as a particular user I have different permissions than when I sudo su into that user. Using su to become quantka causes a git permissions error: sudo su quantka -c "git…
quantka
  • 920
  • 1
  • 10
  • 15
0
votes
0 answers

jsch + running multiple command in shell after SU and then close channal

My requirement is as follow: I have to login to Unix box using my credentials and once login, I have to do su to different user. I need to provide password and reason for scsu command. once su successful, I have to run set of commands one after…
0
votes
1 answer

Azure Regain sudo/su Access

While trying to install a GUI application today I found myself having to disable waagent. Turns out the NetworkManager packages are not compatible with waagent. A few, obviously outdated, posts on the Microsoft forums had me run the following…
Lance Cleveland
  • 3,098
  • 1
  • 33
  • 36
0
votes
1 answer

Running Terminal Command in Android App to Route Audio

So i have an LG P920 I want to Modify The T.I FMrX app to add commands to route audio via tinymix here are the shell commands # tinymix 6 120 # tinymix 66 7 # tinymix 67 7 # tinymix 73 2 # tinymix 74 2 binary is located at /system/bin/tinymix so…