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

learn more… | top users | synonyms

-3
votes
2answers
46 views

How are setuid, suid, sudo, and su all related? [duplicate]

I have a feeling the setuid bit, the nosuid mount option, sudo, and su are all related given their names. But how do they relate to one another? Are some of them used in conjunction? If they are not, ...
3
votes
1answer
52 views

root cannot connect to symlinked socket of other user

I use oh-my-zsh's ssh-agent plugin to have a static symlink to my current SSH_AUTH_SOCK created. When connecting through SSH with agent forwarding enabled the file /tmp/ssh-agent-$USER-screen is ...
0
votes
1answer
19 views

X Forwarding over SSH when switching users [duplicate]

How do I forward X when switching users? I can ssh -X username@server.example.com and open GUIs just fine. However, then when I sudo su to root, the X11 forwarding seems to stop because the windows ...
1
vote
1answer
14 views

How (or is it possible) the Linux desktop X-Server from Terminal under an SU otherusername

I have a simple scenario to demonstrate the use-case for this question Login to Linux as currentuser start bash terminal xauth list $DISPLAY mint/unix:0 MIT-MAGIC-COOKIE-1 ...
0
votes
1answer
72 views

What's different between “su - username” then command and “sudo -u username command”

I have a problem about unixodbc. It show the error message about Can't open lib .... So, I use the ldd command to check. If I use su - username,the result like below: [root@ostest ~]# su - mysql ...
2
votes
1answer
67 views

When can a user do `sudo su` but not `sudo su -`?

The following happened to me: $ sudo su - superman Sorry, user clarkkent is not allowed to execute '/bin/su - superman' as root in krypton101. However the following worked fine: $ sudo su ...
0
votes
0answers
80 views

sudo and su hang indefinitely… stumped

I am trying to run su or sudo on my CentOS 6.6 machine. Every time I try to execute either command, I get prompted for a password. After entering the password, the command simply hangs. I can ctrl+c ...
1
vote
0answers
24 views

What command should I use to explicitly set list of groups and execute a command?

To execute a command as other uid, one uses su. The list of supplementary groups is not specified on command line, but instead read from configuration files (/etc/passwd, /etc/group), etc. Which tool ...
0
votes
2answers
98 views

Fedora 23 password only showing 5 characters. Issues using su command

Today I installed Fedora 23, and once I finished I had no problems the SU command. I rebooted my VM and logged in, and it wont let me use the SU command. When I enter it, it asks for my password. So I ...
1
vote
1answer
83 views

want to su without password inside shell script

I have written a script which will run a script for a backup before: # cat backup-before-shutdown #Scritp to take backup before shutdown #Author Ashish Karpe echo "Taking backup to s3" su ubuntu ...
1
vote
0answers
102 views

Slow script execution

I have a strange problem... My script: #!/bin/bash SECONDS=0 lock_file=/tmp/$0.lock [ -e $lock_file ] && exit touch $lock_file echo "<<<db2_hadr_check>>>" instances=( ...
1
vote
0answers
33 views

Linux/CentOS - can't su after changing ownership

I mistakenly changed ownership of all files on a CentOS system from root to my login account. I can login but if I su I get: su: cannot set groups: Operation not permitted I don't need the system ...
1
vote
2answers
73 views

How do I fix my /etc/sudoers file to recognise me?

Currently, I am receiving the following terminal error: sudo: parse error in /etc/sudoers near line 10 sudo: no valid sudoers sources found, quitting sudo: unable to initialize policy plugin I have ...
1
vote
1answer
125 views

Valid root/user passwords not working on EC2

There is an authentication failure when I'm trying to enter password for any of my accounts after an update using yum. My authentication got broken, while everything else works. The updates were ...
0
votes
0answers
32 views

Why use use su -c to start background processes?

After reading Link im under the impression that using su -c with & would be redundant. My reasoning is that any process started with su -c will be started in a new shell but it will not be killed ...
1
vote
1answer
51 views

Differences between `su` and `su-to-root`?

There are other questions on this forums about the usage of su, su -, su root... etc. But I have found none about the su-to-root command, and I would like to understand the basics of its usage. ...
1
vote
1answer
33 views

Make superuser act like some other user in certain directory tree

I have the following problem: My home directory lies on the network and is mounted locally on home/<my username>. I can access it with my normal user account <my username>, but as root, I ...
0
votes
1answer
65 views

What's wrong with exit command on my terminal?

I'm using Linux Mint 17.2 Cinnamon, and I'm a beginner, just switched over from Win10. Somehow, the exit command isn't working, could somebody help me out?
0
votes
2answers
418 views

`su` command: Permission denied

When I type into bash the following command su -s /bin/bash as root, then no error occurs. When I type su -s /bin/bash -m [MyUserName], then I get the error: Permission denied. As far as I could ...
0
votes
1answer
67 views

Is it possible to execute a command as another user without sudo su'ing to that user?

I do a lot of administration in CentOS6 for several teams. One of the more frequent things I do is sync down and package code as the team account, before deploying it out under my own account. Is ...
2
votes
0answers
28 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
110 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
74 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
1answer
116 views

Bash script with (X)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
195 views

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

I am curious why the super user command su is run and not super user do (sudo).
2
votes
0answers
133 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 ...
1
vote
2answers
237 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
96 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 ...
46
votes
4answers
3k 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
352 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 ...
1
vote
1answer
52 views

Set root password AMI linux

I need to set a password for root on EC2 AMI Linux. I have tried with passwd root but if I log in with ec2-user and run sudo su, I get a root bash without asking for a password.
1
vote
1answer
33 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
268 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
126 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
49 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
31 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 ...
5
votes
3answers
5k 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
238 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 ...
2
votes
0answers
245 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
286 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
159 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
1k 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 ...
1
vote
2answers
183 views

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

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 root. I ...
2
votes
1answer
238 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
270 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
210 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
319 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
311 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
297 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 ...