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
18 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
42 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 <...
-1
votes
2answers
34 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: ...
2
votes
1answer
142 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
25 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
1answer
35 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 ...
0
votes
2answers
45 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@...
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 ...
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 ...
-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 ...
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 ...
2
votes
1answer
103 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?
1
vote
1answer
61 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@...
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 ...
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 ...
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
86 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 ...
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 ...
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
2answers
81 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
153 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
114 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 ...
4
votes
3answers
183 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
74 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
82 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
49 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)...
-3
votes
2answers
116 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
114 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
23 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
22 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
96 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
88 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
476 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
44 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
152 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
177 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
146 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
60 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
190 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 ...
0
votes
1answer
226 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
78 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
127 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
39 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 ...