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

learn more… | top users | synonyms

0
votes
3answers
888 views

What 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. ...
2
votes
1answer
390 views

Setting the root password vs. sudo -i

Should one always set a root password, or is sudo -i acceptable? Two problems is in reading other posts (maybe junk I realize): sudo -i eliminates the need for a password. Isn't that a problem for ...
4
votes
4answers
3k views

Should I use `sudo` or `su` in a startup script?

I have a personal program, that has a server/client design. The server daemon part of it, should be run as its own limited user, and the program was not designed to drop its root privileges (if ...
2
votes
1answer
2k views

Can't use su or sudo on Arch Linux

Sudo returns this error: sudo: effective uid is not 0, is sudo installed setuid root? And su - returns this: su: Authentication failure The user I'm using is a member of the following groups: ...
7
votes
1answer
1k views

How to stop users from Switching to Root user

I have disabled the root user login from Sshd.conf file so now no one can login using root user even if they know the password SOMEHOW. Now I have 3 users in server ROOT,EMERG and ORACLE. I want to ...
2
votes
3answers
2k views

su: Permission denied despite correct password

In my new Gentoo installation, su doesn't work as my non-root user: After entering the correct password I get the message "su: Permission denied". What could be causing this? I have already tried ...
0
votes
1answer
276 views

SSH minimal rights user - su only [duplicate]

Possible Duplicate: Creating a UNIX account which only executes one command I am trying to setup a user account that only has as minimal rights as possible. The user should be able to log ...
9
votes
1answer
801 views

Why does “su -c <command> &” seemingly allow a command to run in the background without hanging up

I was helping a colleague who was having problems with a background process intermittently dying. I found out that they were starting the background process by logging in to the server and executing: ...
6
votes
2answers
265 views

Why doesn't su change the user ID of the shell from which it was run?

Instead, it starts a new shell process with the new user ID. The original shell is blocked until the new shell completes and su exits. Why does it work like this?
3
votes
1answer
497 views

Why can I only use apt-get when I use “su”?

Not sure what info you need here, if any. Just let me know. I have a proxy that bypasses the corporate net set in my profile file for both su and normal user. When I do a sudo or regular apt-get ...
0
votes
1answer
3k views

How to use sudo in Fedora?

I use to be a fans of Ubuntu, when I want to execute a command as root user, I do this sudo blah_blah_blah. But in Fedora 16, it doesn't seem recognize this command. Any clue on this?
0
votes
1answer
632 views

script to switch users keep running? [duplicate]

Possible Duplicate: Switching to superuser while shell script is running I need to switch users in a script and keep executing commands. I thought -c would help but i don't know how to use ...
1
vote
3answers
1k views

Ask root for password when using su command

I'm trying to edit /etc/sudoers via visudo, but I don't know how to change the root rights. I want root to be prompted for the user1's password, when he tries to use su user1.
1
vote
3answers
2k views

Shell script to become root

How can we write a shell script to become root? That is I donot want to input the password at prompt it should be within the script itself. I was trying to make but failed to do so.Is it possible, if ...
0
votes
2answers
806 views

How to suppress su authentication failure warning?

I created an account "diag" and set it as expired (usermod --expiredate 1). Then I have a script which I want to run to log into it, so in the script I use the following command: su -s /bin/bash - ...
2
votes
1answer
309 views

su and redirection

The following line shows the principle of a construct which I can use under Red hat 5.5: $ echo "foo" | ssh myhost "echo \"cat <&1\" | su --login" foo Actually it was never clear to me why ...
0
votes
2answers
5k views

Avoid asking password if `su -m user command` is used under `user`?

If I run the script containing su -m user service userservice start under root user, I do not need to enter the password. But when I run it under user user, it asks passwords all the time. That really ...
0
votes
1answer
2k views

su authentication failure after setting new password

I compiled a new kernel(3.2) and I have it running on an ARM board. I wanted to enable some params on the /proc directories. Therefore I have to be logged in as root. Hence I did the following on my ...
4
votes
2answers
3k views

Change user and load entire environment in shell script

I'm having some trouble with an upstart script of ours that changes user and starts up a few ruby daemon processes. In the past i would simply bash -c "do the business" -l someuser making sure to use ...
2
votes
2answers
381 views

Am I using bash after this ordeal?

On Mountain Lion, host Coguaro, I login as user coconutpowder using bash: Coguaro:~ coconutpowder$ echo $0 -bash I need to run a command with elevated privileges so I try to su switch to root but ...
2
votes
1answer
790 views

su-to-root fails when root user locked?

How might I use script /usr/bin/su-to-root after I have intentionally locked the root account? Running Debian GNU/Linux 6.0.5 "squeeze" and noticed menu item "System > Administration > Synaptic ...
4
votes
3answers
2k views

Automate login with sudo and su

I know the security risks, but I am performing this experiment/exercise on an old, seldom used *nix machine I have laying around the house. So doing this exercise will not bring any security risk to ...
2
votes
4answers
2k 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
3answers
2k views

Switching to superuser while shell script is running

I have a shell script that contains the following lines: CURRENT_USER=${USER} echo $CURRENT_USER su echo switch to `who am i` Once the 2nd line is executed, the shell prompts me to enter the root ...
1
vote
1answer
544 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. ...
3
votes
1answer
162 views

On OS X, how do I log in interactively as root starting from my normal user account?

I have been doing this for a while: sudo su - but it uses 'sh' rather than 'bash', which is what I'd like to do. Which command will log me in as root and get me a bash shell even if that's not the ...
9
votes
4answers
3k views

su does not change user but does not respond with an error either

While logged in as root I would like to su to a specific regular user. I run su username and immediately receive the prompt back, still as root. There is no error given. I'm aware of the old "the user ...
1
vote
1answer
527 views

How to invoke root privileges from a password prompt of “Software Update” window?

When I try to install software updates using the "Software Update" GUI, I am asked for the root password. Although, I can 'su' in a terminal, the password is not recognized as correct in the GUI ...
17
votes
2answers
9k views

su vs sudo -s vs sudo bash

What is the difference between the following commands: su sudo -s 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 what is ...
1
vote
1answer
2k views

Run expect inside a bash script as another user

I am writing a bash script to install some small software I'm developing. That script is run with sudo (as root), but some of the commands that are executed by the script need (or should be) run with ...
0
votes
4answers
10k views

Is there a difference between sudo su - root and sudo -u root -H /bin/bash?

Like title says, is there a difference between these two commands : sudo su - root sudo -u root -H /bin/bash I'm using GNU/Linux, if that makes a difference.
3
votes
3answers
1k views

linux launch script /etc/init with a specific user

I've created a script in /etc/init/mms-agent.conf : start on runlevel [2345] stop on runlevel [06] exec /usr/bin/env python /home/mms/mms-agent/agent.py >> /home/mms/agent.log 2>&1 ...
1
vote
2answers
4k views

Changing user in a script?

I am trying to change user in order to execute a specific command during startup. It fails silently and apparently the userchange isn't carried out as I can tell that the command isn't executed. What ...
2
votes
3answers
996 views

using here script I/O redirection with su command

here is my script. I want to login with another user and do ls -lih: #!/bin/bash su - testuser <<- _EOF_ 123456 #password _EOF_ ls -lih here is the output when i ran script: ...
10
votes
3answers
7k views

.bash_profile not sourced when running su

I have a user, say user1, which has modifications to its .bash_profile, one of them changing the PATH, e.g.: export PATH=/some/place:$PATH. This change works fine if I log on as user1 or do a su - ...
5
votes
3answers
2k views

Changing the UID of files in /proc

In a follow up to this question about changing the UID of a user, it is recommended to change the ownership of all files on the system (this answer) find / -uid 1000 -exec chown 5000 '{}' \+ where ...
2
votes
2answers
934 views

su - username -c “./script.sh” -> no such file or directory

We have: a user nico. a folder /home/nico/script_home with some bash scripts: main.sh subscripta.sh sqlscripta.sh We connect as root and cd /home/nico/script_home/ Finally we run ./main.sh We ...
0
votes
0answers
299 views

Why do you need sudo for “sudo su root”? [duplicate]

Possible Duplicate: When do su and sudo use different passwords? Why do you need to use sudo su root ? Why won't it work to just use su root?
4
votes
3answers
2k views

Find out if a session is running under `su`

I'm trying to check whether the current shell session is running within a su login session. What's the best way to test this condition?
7
votes
1answer
6k 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 ...
8
votes
1answer
1k views

What is the difference between 'sudo' and 'su -c'

Is there any difference between using sudo and using su -c? There are situations where one should be used but not the other? I was previously using Ubuntu where sudo appears to be ubiquitous but now ...
2
votes
1answer
851 views

sulog with openSUSE 11.2 (x86_64)

I need to log as much as possible when users a doing su *... Best would be to log all commands especially for the case root does something as a user. We can assume root would not change this logging ...
11
votes
2answers
9k views

What is the difference between 'su -' and 'su root'? [duplicate]

Possible Duplicate: Why do we use su - and not just su? I understand that root doesn't have to be a superuser. But in the case that it is ... what is the difference between sudo su - and ...
4
votes
1answer
516 views

Why do I need to use newgrp or su (or logout and login again) to have new group memberships applied?

What is it that makes new group membership require a new login (or new login shell as started by su or newgrp) to be visible? Just running another bash (or whatever other shell) instance with --login ...
14
votes
1answer
1k views

What's the difference between sudo su - and sudo su --

When I am working on our RHEL machines, I use sudo su - to switch to being root. One day, a typo meant I typed sudo su -- instead - it seems to me that everything was the same as with a single hyphen, ...
5
votes
2answers
1k views

Alternative to su/sudo on barebone system

I'd like to run some unit tests in a barebone chroot jail on Solaris. There's no su or sudo, and a copy of su (with libpam.so.1) just returns exit code 1 without any output, with or without ...
2
votes
1answer
163 views

Is it possible to set su to use WE password dialog

I have sometimes problem when during entering password for su other window appears and steals the focus ("wait - did I just entered root password on public IRC chatroom?" - it did not happened but ...
2
votes
3answers
5k views

running multiple commands for su in bash

I would like to use su -c to run as root multiple commands altogether. I don't want to use an extra script for this. I tried the following su root -c "tcpdump -i wlan0 -s 1500 -w CCCCCC & " ...
2
votes
1answer
1k views

FreeBSD: Opening X applications after su to root?

Using FreeBSD 8.2. I'm accessing my machine over vnc using tightvnc. I log in as my normal user. This is okay. I can open X applications and they display fine. Then I su to root and they won't ...
13
votes
4answers
865 views

What is SSH - the protocol and what is ssh - the utility?

What is SSH - the protocol? What is ssh - the unix utility and how does it work? How is SSH protocol related to SFTP? What is sshd? Does the command su use ssh or sshd?