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

learn more… | top users | synonyms

1
vote
1answer
20 views

login with apache user

I'm following this tutorial step by step,for Here we clone the repo into a chmodded /var/www/[site_dir] folder. Note that we switch to the www-data user before running the git clone command. ...
0
votes
2answers
44 views

Switch user using password from file

how can i switch user using su command and adding password from file ? i want to make a script which will automaticly switch the user, having the user and the password ,instead of manually typing the ...
1
vote
1answer
40 views

Su as root and run command in one line

I need to su as root and run a command as a single line. This is for use in a python script. What I am looking for is: $ su root [some-magic] sh /home/jay/script-that-needs-executing-as-root.sh <...
8
votes
3answers
12k 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
votes
2answers
35 views

Privilegies of command inside shell script

I need to run simple script to check host status (ping), I have following script: #!/bin/bash echo "Host checker:" if [ "`ping -c 1 172.17.10.1`" ] then echo "HOST UP" else echo "HOST DOWN" fi ...
1
vote
1answer
14 views

How to disable su for group by using pam_succeed_if?

I'm trying to disable su for call group ids (gid) which equal or greater than 1003. My solution was as below but it didn't work. It failed for users who in lesser gids as well. Failed solution: ...
7
votes
3answers
314 views

How to harden su with dpkg-statoverride?

I am reading an Ubuntu 14 hardening guide and this is one of the suggestions: It generally seems like a sensible idea to make sure that only users in the sudo group are able to run the su ...
2
votes
1answer
143 views

Why can't I run a command as a user having /bin/false as login shell?

I attach to a docker image where user has already been created with this command: RUN useradd -r -u 200 -m -c "nexus role account" -d /nexus-data -s /bin/false nexus I wanted to run a command as ...
-1
votes
0answers
70 views

What is the difference between “sudo su -” and “sudo su -l”?

On Xubuntu 14.04, looking at the man pages, su - and su -l should be the same. -, -l, --login Provide an environment similar to what the user would expect had the user logged in directly. I ...
0
votes
0answers
26 views

Why doesn't `su -` re-read /etc/environment?

I have the following line in /etc/environment: AAABBB=cccddd When I login using the text console, the variable is set, I don't even need to reboot. But if I do su -, the variable is cleared. Why is ...
0
votes
2answers
46 views

Booted from NFS Linux has no permission for su command

I've booted Linux from NFS with Android system. And now I have to execute command as super use in minicom. But system doesn't allow me to switch to super user mode. Every time when I type: shell@...
0
votes
1answer
36 views

adding a sudoer in debian

After a long search on the web, trying everything I can find I came to ask you guys, how can I add an existing user to be a sudoer? I've tried usermod -a -G sudo user and also adduser user ...
2
votes
2answers
45 views

Command behavior is different when executed by an other user (via su -c)

I want to kill every processes who match a specific chain. Here is my script, which works pretty well: echo `ps aux | grep verySpecificChain | grep -v grep | /usr/bin/awk '{ print $2 }'` | xargs kill ...
2
votes
0answers
14 views

run gvfs-mount as user in a script owned by root for networkmanager dispatcher

I'm trying to create a script to auto mount using gvfs-mount for NetworkManager dispatcher. The dispatcher requires the script to be owned by root. Running gvfs-mount smb://path/ works in terminal as ...
2
votes
3answers
133 views

Why can I switch to a user but not run a script as it

If I try to switch to a user using command sudo su - kshitiz. It works fine and switches without asking for a password. But if I try to run a script as that user it asks me for a password. sudo -u ...
-1
votes
3answers
47 views

Run su -s with arguments

I run to run a command using the su -s command to start a process. Since I do not want the root user to own the process. I try to do this by issuing the command su -s "$CATALINA_HOME/bin/catalina.sh ...
5
votes
2answers
5k views

Unable to pass the password to su in a script

I am writing a build script. This script has to copy a file in the end. This file will be placed in another users home directory and it is also necessary that the file belongs to this second user. My ...
1
vote
2answers
764 views

Combined su and screen at startup

I want to start a long running custom script at boot. The script must run under a specific username. So far I have successfully used the screen command and switched to the user in the custom script. ...
2
votes
1answer
107 views

error thrown when using su -c: bash: no job control in this shell

I have written a script which should execute certain commands as another user and after execution is finished (success or failure) should logout immediately. I have read that I can use -c of su to ...
0
votes
1answer
46 views

Is it safe to uninstall `su` in favor of `sudo` to harden Arch Linux? [closed]

Is it safe to uninstall su in favor of sudo to harden Arch Linux? Have you got an opinion on whether this is a good or bad idea? I read the Arch Linux Wiki articles Security, Su and Sudo. I also ...
0
votes
1answer
31 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?
21
votes
2answers
60k 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
619 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
67 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 mahmood@...
25
votes
4answers
42k 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
7k 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
3
votes
2answers
15k 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
384 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
32 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
41k 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 ...
3
votes
2answers
6k 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
258 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
87 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
75 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
38 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
38 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
82 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
154 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
117 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 /user_path/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:...
4
votes
3answers
187 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
75 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
84 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
51 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 this)...
118
votes
6answers
42k 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
117 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
300 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
33k 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 ...