su is a utility to run a shell or other command as another user (root by default).

learn more… | top users | synonyms

2
votes
0answers
19 views

Slackware su man pages does not mention /etc/suauth, what reason?

I've been reading the man pages before I start restricting su access to certain users (I'd like to not rely on sudo if possible). There is no /etc/suauth file so I was going to create my own and ...
1
vote
4answers
56 views

What's the difference between sudo su vs just su?

I see a lot of posts out there that say you type in sudo su to get an interactive prompt with root privileges, and I see equally many posts debating the pros and cons over sudo -i vs sudo su. Here ...
0
votes
1answer
24 views

ssh master - execute su remotely

I have a server S that I need to connect to. I'm connecting to S as user asdf with control master and after that I perform some stuff: ssh -N -f -M -o ControlPath=$SSHSOCKET ${USER}@${IP} -p ${PORT} ...
1
vote
0answers
38 views

Bash script (dialog) asking for root password (kdesu substitute)

I'm using (X)dialog for a script that a normal runs, but it needs root privileges for some commands. The script runs from a .desktop file, thus the user sees no terminal. For example here #!/bin/bash ...
-1
votes
2answers
69 views

When in debian 8.1 why is the super user ran with su not sudo? [closed]

Just curious about why super user is ran and not super user do.
2
votes
0answers
63 views

Difference between 'xhost + ' and 'xhost +SI:localuser:AnotherUser'

If I do xhost + >access control disabled, clients can connect from any host su AnotherUser -c xterm an xterm popups, but if I do xhost +SI:localuser:AnotherUser >localuser:AnotherUser being ...
0
votes
0answers
27 views

su success, but says No protocol specified

I can successfully log in as root on Debian Jessie as follows ...:~$ su Password: No protocol specified root@... It's a fresh installation, just a few applications added so far. I just had to do ...
1
vote
2answers
45 views

run command with sudo su in script and redirect stdin and stdout

I need to run command as another user and write to its stdin and read from its stdout. I can run command as another user only via opening new shell: sudo su anotheruser but with new opened shell i ...
3
votes
2answers
75 views

Why does man page completion fail after su?

I have a default Debian 8.1 installation. I do su man apt<TAB> but get nothing. I do see the manual when I write man apt-get in both modes: as user mas and as root. However, tab ...
43
votes
4answers
2k views

Is there ever a good reason to run sudo su?

To launch a root shell on machines where the root account is disabled, you can run one of: sudo -i : run an interactive login shell (reads /root/.bashrc and /root/.profile) sudo -s : run a non-login ...
3
votes
1answer
94 views

Possible to pipe command using su via ssh

I'm trying to write a python script to remotely update the login passwords for a set of account I administer - I can already successfully use python to pipe remote commands via the stdin of an ssh ...
0
votes
1answer
25 views

Set root password AMI linux

I need set a password for root on EC2 AMI linux. I have tried with passwd root but if I enter with ec2-user and run sudo su, I get a root bash without asking for a password.
1
vote
1answer
27 views

Disabling su - <user1> alone

In my Team , we have a server which few people know the root password I can see they log into root and then use su - user1 to use from user1 login., I cannot change root password for some reasons , ...
1
vote
2answers
64 views

sudo / su to user in a specific group

I am looking to setup a generic user that has the ability to su/sudo to any user in a specific group. Either that or to any user that has a specific naming scheme. Is this possible on linux? I ...
0
votes
3answers
61 views

switch to sudo user with AND command doesnt work

I am trying to copy the ssh private key from one user to another user in single shot. sudo su && cp /home/sk/keys/master.pem /home/sg-user/keys/ This command works well, when i run them one ...
0
votes
0answers
17 views

su - with -s option and environment - why symbolic link doesn't work? [duplicate]

here's the trick: [root@aaa ~]# su - -s /bin/sh gerrit -c 'env' HOSTNAME=aaa JAVA_HOMEC=/opt/jdk/ SHELL=/bin/sh TERM=xterm-256color HISTSIZE=1000 JRE_HOME=/opt/jdk/jre/ USER=gerrit ...
0
votes
0answers
45 views

Use sudo as login

I've picked up the habit of using sudo and disallowing root logins. In cases, sudo is integrated with GUI configuration tools that require it. Are there any serious efforts to replace login and ...
2
votes
0answers
22 views

Bind a directory as me

Analogous for a regular user running a thin FTP server (where others can access the file system with his/her permissions), can a regular user (through fuse maybe) "mount" a directory for others to use ...
2
votes
2answers
869 views

how to pass environment variable to sudo su

I basically need to do this: DUMMY=dummy sudo su - ec2-user -c 'echo $DUMMY' This doesnt work. How can I pass the env variable $DUMMY to su? -p doesnt work with -l.
1
vote
3answers
115 views

Differences between sudo and su in inheriting environment

Why can the command run by sudo inherit the environment from the parent shell process, while the shell process after sudo su to the root user doesn't? t@ocean:/tmp$ export ME=tim t@ocean:/tmp$ sudo ...
1
vote
0answers
120 views

Decrypting with GPG after a “su - different user”

I have cron job running a script in the cron of "USER A" that encrypts many files in a loop using the gpg command below: gpg --batch --cipher-algo AES256 --passphrase "PASSWORDISHERE" -c FILENAME ...
0
votes
2answers
122 views

executing command as su

I am executing this command as su. I have made the connection with SSH (using sshNet), and then when I try to set the command su -, I get no response. I have the password and the command I would like ...
1
vote
1answer
102 views

Running some parts of a script as an unprivileged user with shell environment

I am creating an instance configuration script that sets up a machine. I am running the script via sudo i.e. sudo run.sh. Most of the steps require root access but some of the script's steps do no ...
2
votes
3answers
439 views

Why root does not source .bash_profile?

Everytime I try to login as root using su (not su -), it doesn't source .bash_profile in user1's home directory. Basically my /var/root directory doesn't have .bash_profile, so I put a copy of ...
0
votes
2answers
80 views

Run script on non-full bash-login invoked as “sh”

Good day I'm currently trying to modify my terminal to have the prompt displayed in a different colour than the whole rest of the shell, and I would like to make it white for normal users and red for ...
1
vote
1answer
85 views

Can't switch to a specific system account with su

I can't switch to user jenkins on an OpenVZ container. There is still a jenkins process running, which was started by this user. I tried # su jenkins; it does not switch to the jenkins user. There is ...
1
vote
2answers
173 views

su -c command fails when sending db2 commands

I have a script I've setup to run a number of tasks, one of which is to set up a table in a DB and later remove it (for automated testing). The issue comes that on only a few of the users that I use ...
0
votes
2answers
117 views

Why doesn't `sudo su -l -c “java”` work even though `sudo su -l -c “echo $PATH”` displays the location of the java binary? [duplicate]

I have a server with Java binaries from a tarball on a custom location, and the following in /etc/bash.bashrc: export JAVA_HOME=/path/to/java/home export PATH=$JAVA_HOME/bin:$PATH When I run sudo ...
3
votes
3answers
187 views

SUID accidently removed from /bin/su file

It is a production server - CENTOS 6.1 Some user having root access in the past had logged on to the server and removed the SUID bit from the /bin/su file and then exited root. Now we are not able to ...
1
vote
2answers
167 views

Any special permission ssh remote command working on fifo file(aka named pipe)?

I need to redirect some strings to a fifo file with ssh remote command, but always got permission denied, the command I executed is: ssh rundeck@nagios1 sudo su - root -c 'printf ...
0
votes
2answers
136 views

provide password for script begin called inside another script [duplicate]

I have written a shell script which in turn calls another script, but the second one prompts for password. I want to supply the password and pass the prompt without user begin notified. Here is my ...
1
vote
1answer
98 views

su or sudo keeping/removing certain environment variables

I would like to be able to log in as another user and keep most, but not all of my environment. Specifically, I would like to set $HOME to the correct value for the new user, but keep probably ...
1
vote
1answer
75 views

How to switch user with pre-configured credentials in SSH Terminal after logging in as standard user

I was wondering how to execute a command file where: After logging in as a standard user, I want to switch user to "username" with password being "password", I can successfully execute the command.txt ...
0
votes
1answer
75 views

shell scripting and running after switching to other user

I have the following commands that I want to have them all in one shell file: su – s3 lizinfo.sh –b when the first linex executes, it prompts and the command prompt become like as below: ...
0
votes
2answers
68 views

Ubuntu CentOS RHEL cross bash script su support

I know that title was a little ambiguous. Allow me to explain our issue. We designed an installer script on Ubuntu since Debian based systems are our primary core, however, some of our cloud based ...
0
votes
2answers
50 views

Maintaining the Current Style of the Command Prompt After Using 'su?'

When I use the su command in OS X's Terminal — say, to quickly switch to an administrator account to mount a drive using diskutil — the style of the command prompt changes. ...
6
votes
1answer
318 views

When running 'su - username', pam_group doesn't add additional groups from /etc/security/group.conf but sshd login does?

I am having trouble determining why su doesn't behave as the PAM configuration would imply. In short, using su to become another user should load secondary groups according to PAM configuration, but ...
0
votes
1answer
49 views

Is there a way to see which user is logged into the system and has switched with “su”?

There are many person that may have access to the system and use a common user with more grants. How can I see which user is running a command? is there a way to use "ps" for that?
-1
votes
2answers
250 views

Is it possible to write a script that run su or sudo command without typing password? [duplicate]

Is it possible to write a script that run su or sudo command without typing password?. I googled and its said that su doesn't read password from buffer. So is there any solution?
3
votes
2answers
655 views

Is there a graphical sudo (kdesudo, gksudo, su-to-root, …) tool that works passwordless?

Apparently gksudo is not obeying /etc/sudoers, neither does kdesu. Therefore asking the other way around... Is there any su-to-root, gksudo, kdesudo, etc. alike tool, that supports starting gui ...
3
votes
1answer
53 views

limits.conf modification doesn't work

On a SLES 9 machine I added the line: vi /etc/security/limits.conf USERNAME hard cpu 70 but when I check it with "ulimit -a": SERVER:~ # su USERNAME USERNAME@SERVER:/root> ...
0
votes
1answer
59 views

/etc/sudoers file help in giving access to all command in UNIX

/etc/sudoers file help in giving access to all command in UNIX. I read it has rules specified like #root ALL=(ALL|ALL):ALL that specifies root accesses. My question is when we execute a command ...
0
votes
2answers
2k views

Unable to su into an account: could not open session

in my Linux machine - red-hat I successfully to login to different users as the following su - userC [machine@Linux ~]$ pwd [machine@Linux ~]$ /Users/userC but only in one user I get the ...
1
vote
1answer
36 views

How to propagate TSTP while running a program as a different user

I'm running a terminal application via "su" in this fashion: su -c "/path/to/app --args" username This is done from a root context, and 'username' is a less privileged user in the system. The ...
0
votes
1answer
686 views

Bash script class path issue with java

Content of /opt/scripts/jvm/jvm.script.sh #!/bin/bash JAVA_HOME='/java' PATH="$PATH:/$JAVA_HOME/bin" java -cp ./classes:./lib com.mystuff.bar.foo.myclass & Content of /etc/init.d/init.script.sh ...
1
vote
1answer
2k views

Ubuntu runuser command?

I am creating a bash script that requires to run commands as a specific user. As a result I am using the command: runuser I have tested this script and it works perfectly in Ubuntu Server 14.10. ...
2
votes
1answer
108 views

Problem with either su username -c “./script.sh” and sudo -u username bash -c “./script.sh” and Java classpath

I am seeing some strange behavior that has led me to wonder how the environment differs when running either of these 2 commands, versus using su username and then running the commands as the user one ...
1
vote
2answers
161 views

Fedora: How can I add myself back to sudoers file?

I've accidentally removed myself from sudoers file by doing usermod -G user group without -a, and now I am not in the sudoers group. I've tried doing su - and entering root's password but it says su: ...
1
vote
1answer
85 views

Accidentally deleted /bin/su

I was working in /bin on my Ubuntu system and ended up deleting su via a typing error while trying to do other editing. So now I have no way of swapping back and forth between users and root. I have ...
5
votes
2answers
105 views

Permissions depending on how you login: ssh/su/sudo

As user I have access to a remote linux machine where I can: sudo su - other_user Among other things, this allows me to add my own public key to authorized_keys for other_user, which effectively ...