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

learn more… | top users | synonyms

0
votes
1answer
23 views

Difference between su and su - [duplicate]

I wonder what's the exact difference between these 2 commands:1. su 2. su - . Can anyone please explain?
19
votes
2answers
54k views

su options - running command as another user

I was wondering how to run a command as another user from a script. I have the script's owner set as root. I also have the following command being run within the script to run the command as the ...
1
vote
2answers
554 views

How do you keep the password hidden when invoked during the su command?

This is the first time it has happened to me where I am using the su command and it actually displays the password on the terminal and doesn't stay hidden. Here is my code snippet: sshpass -p ...
1
vote
1answer
36 views

X11 forwarding via SSH and su

For me, it is weird that while using ssh connection with X11 forwarding, a user and root are able to see xclock, but another user is not able to see that. Why? mahmood@cluster:~$ xclock ^C ...
25
votes
4answers
37k views

“su” with error “X11 connection rejected because of wrong authentication”

As root, I'm connecting to a remote host to execute a command. Only "standarduser" has the appropriate id-file and correct .ssh/config, so I'm switching the user first: su standarduser -c 'ssh -x ...
3
votes
4answers
6k views

Allow paswordless user to change to another passwordless user

I have two users dev and tomcat neither of them have a password. How can I allow dev 1 do su - tomcat without having him having to enter any credentials? 1 connects with ssh keyfile
2
votes
2answers
14k views

can't ssh into remote host with root, password incorrect

I have a remote host, previously I can ssh into it with root and password ssh root@remote_host or I ssh into it first using a regular user account ssh esolve@remote_host and then su root and ...
1
vote
2answers
346 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
1answer
23 views

Cannot switch to a non-admin user

Seems like I can't su unless the user is admin. When trying to ssh into the user or su username i get: Cannot execute /bin/bash: Permission denied Have tried almost every solution I could find on ...
13
votes
3answers
38k views

I Can't login as root with su command, but I can with SSH

How is it possible that I cannot log in as root by su root or su (I get incorrect password error), but I can log in by ssh root@localhost or ssh root@my_local_IP with the same password? I'm using ...
0
votes
0answers
18 views

su permision denied from terminal Arch linux [duplicate]

When I try to become super user (root) from terminal I receive permission denied, but when I try from tty console (press ctrl + alt + F2) I have access to root. My question is how can I receive ...
2
votes
2answers
5k 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 ...
2
votes
3answers
2k views

Why does sudo su work, but su does not? [duplicate]

I have tried this on Fedora and on Ubuntu. kshitiz@kshitiz:~$su su: Authentication failure kshitiz@kshitiz:~$sudo su root@kshitiz:/home/kshitiz# I am entering the same password in both the cases. ...
5
votes
2answers
256 views

How is the su command masking/protecting my password from being displayed on screen? [duplicate]

Apologies if this is an abstract question - I'll try to be as specific as possible. When I'm at the bash shell and switch to a different account via su - foo, I'm prompted for a password. The ...
0
votes
1answer
65 views

Allow multiple users to “su” to multiple other users without password

This is similar to this question: Allow user1 to "su - user2" without password However, the solution only work for multiple users accessing "su"ing ONE user. #works fine :) 2 or more ...
1
vote
2answers
58 views

Why does util-linux runuser (su) fork?

Using runuser from util-linux (a different entry point for su, which only operates if starting from root), one sees a process tree that looks something like the following: [root] runuser -u username ...
1
vote
0answers
35 views

Switching (su) to a paswordless account

I've made account A passwordless with passwd -d A. Now, when I log in as user B from a terminal and run su A I can switch to user A (and I am not even asked for a password). If, however, I log as ...
0
votes
1answer
32 views

command line in su - and background

I am writing a simple unix script to automate reading of a log file. The following does not give any output to the terminal. It just asks for the password for buser and then it just hangs. I ...
0
votes
2answers
76 views

How to use cd command in su command?

In the below script the cases aserver and bserver work fine. But in case "cserver" above, after su - gsxuserp, I need to perform the following three options with the same user. cd .. cd ...
0
votes
0answers
85 views

Unable to su to any user as root on Red Hat 6.7 server

System: Red Hat Enterprise Linux Server release 6.7 (Santiago) I am trying to su to kms user(OS user) as root but i keep getting error saying You are required to change your LDAP password ...
1
vote
2answers
80 views

Can't get user $HOME over su on Solaris and AIX

I'm trying to get user $HOME variable over su. Solaris # su oracle $ echo $HOME /root AIX # su oracle $ echo $HOME / Linux # su oracle $ echo $HOME /home/oracle Can someone explain why on ...
3
votes
2answers
3k views

su vs su - (on Debian): why is PATH the same?

I know what should be the difference between su and su -, but in my system (Debian) for example PATH is the same: [root]# su [root]# echo $PATH ...
4
votes
3answers
148 views

What exactly differentiates the root user from every other user?

What are the fundamental differences between some arbitrary account and root? Is it just the UID being something other than zero? So, what exactly does the su binary do and how does it elevate a user ...
1
vote
1answer
56 views

X11 authentication is not working in `sudo sux / sudo su`, but works in `sux / su.` Why?

I have a vnc session and I can access X11 just by doing su - user, for other user, without the need of sux. Also, when I am trying to switch to user, using sudo sux - user or sudo su - user, I can't ...
0
votes
0answers
61 views

debian 8 cinnamon file manager ssh as super-user

On a linux remote server I've a user who can become super-user without typing the password, e.g. simply typing sudo -s. Using winscp on windows there is an option to pass the sudo command (sudo su ...
1
vote
0answers
35 views

Run mkvirtualenv command as another user

I want to run the "mkvirtual sth" but I have to run the script as superuser. sudo ./install.sh install.sh looks like this: # ... mkvirtualenv sth # su - geeret -c "mkvirtualenv sth" # (tried ...
112
votes
6answers
40k views

Where did the “wheel” group get its name?

The wheel group on *nix computers typically refers to the group with some sort of root-like access. I've heard that on some *nixes it's the group of users with the right to run su, but on Linux that ...
-3
votes
2answers
75 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, ...
0
votes
2answers
278 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 ...
4
votes
3answers
30k views

Cannot connect to X server :0.0 as superuser

When I am online, I get following error and the tool does not start: [root@dhcppc9 lin64]# ./ise No protocol specified _pn: cannot connect to X server :0.0 But everything is OK when I am not a ...
3
votes
1answer
83 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 ...
8
votes
2answers
9k views

How to run a GUI program as a different user (Debian)?

Using a terminal, I can change the running user with su and sudo — but how can I do that by clicking on an icon/shortcut on the desktop/start menu? If I have to be root to execute I will be asked ...
0
votes
1answer
20 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
20 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 ...
6
votes
3answers
9k 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.
0
votes
1answer
85 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
82 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 ...
13
votes
3answers
7k views

Difference between sudo -i and sudo su [duplicate]

I was wondering what the difference is between sudo -i and sudo su?
47
votes
4answers
4k 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 ...
0
votes
0answers
258 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
33 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
141 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
157 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 ...
2
votes
3answers
2k views

How can I sudo su and change directory just after?

I would like to create an alias that does something like this: alias userYYY='sudo su userYYY; cd /a/path/that/only/userYYY/has/access' So then from my command line, I am logged in with a sudoer ...
1
vote
0answers
128 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
3answers
234 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
0answers
51 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
4k views

Problem executing command as a different user with sudo -u

I have the following problem: When I'm trying to execute ls as user abc with the following command I get an error: xyz@host:~/temp$ sudo -u abc ls [sudo] password for xyz: Sorry, user xyz is not ...
41
votes
2answers
18k views

su vs sudo -s vs sudo -i vs sudo bash

What is the difference between the following commands: su sudo -s sudo -i sudo bash I know for su I need to know the root password, and for sudo I have to be in the sudoers file, but once executed ...
1
vote
2answers
130 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 ...