su is a utility to run a shell or other command as another user (root by default).
1
vote
1answer
25 views
New Terminal not works when we use su root
When I use
su root
and then use
gnome-terminal
I get warning
** (gnome-terminal:2677): WARNING **: Failed to connect to the session manager: None of the authentication protocols specified ...
48
votes
5answers
9k 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 ...
1
vote
3answers
2k 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 & " ...
1
vote
1answer
225 views
automate login as sudo and su
I know the security risks, but I am performing this experiment/excercise on an old, seldom used *nix machine I have laying around the house. So doing this excerise will not bring any security risk to ...
4
votes
2answers
82 views
Two GUI applications as different users on the same screen
I am logged as user A. I want to run a GUI application as user B. User, not root. User B is local too, not remote, I only need different environment variables. I don't want to run the second X, I want ...
0
votes
1answer
33 views
Difference between sudo su - user and sudo -iu user [duplicate]
I was wondering if there were any difference (in environment ?) between doing
sudo su - user
and
sudo -iu user
From what I know:
By using
sudo su - user
I open a new shell as user, and the ...
-1
votes
1answer
57 views
Where does sudo get the currently logged in username from?
When I tried to "sudo su" instead of "sudo su -" after having been logged in as root and su-ing to another user, it tries to sudo me as the new user, but via root...
When I type env, it shows still ...
1
vote
3answers
194 views
Using sudo in openSUSE without actually changing to root user (i.e., like in Ubuntu)
I recently started trying openSUSE 12.3 after having used Ubuntu for a few years. I'm still getting used to openSUSE's treatment of su (and sudo) vs. Ubuntu's use of sudo. I've been reading the ...
9
votes
4answers
707 views
Why doesn't “sudo su” in a shell script run the rest of the script as root?
A sample script can be as below:
#!/bin/bash
sudo su
ls /root
When using ./test.sh as the normal user, instead run ls as super user and exit, it switches to root; and when I logout, it executes ls ...
2
votes
2answers
56 views
How to su to www on OpenBSD?
I have a PHP script that I wish to run under the www account.
The account has nologin as shell and is used by Apache.
When I run "su -l www -s /bin/ksh" as root, I get the following message:
This ...
0
votes
3answers
97 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
4answers
174 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 ...
1
vote
1answer
107 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 ...
2
votes
1answer
487 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
214 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
2answers
195 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
135 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 ...
8
votes
1answer
227 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
124 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?
1
vote
1answer
411 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 ...
0
votes
1answer
714 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
194 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 ...
16
votes
5answers
7k views
What is the need for 'fakeroot' command in linux
Why do we need fakeroot command at all? Can't we simply use the sudo or su commands?
The man page says:
fakeroot - run a command in an environment faking root privileges for file manipulation
...
1
vote
3answers
319 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
571 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
813 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 ...
2
votes
1answer
178 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
344 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 - ...
0
votes
1answer
816 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
593 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
301 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
461 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 ...
2
votes
4answers
424 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
466 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
123 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. ...
69
votes
7answers
7k views
Which is the safest way to get root privileges: sudo, su or login?
I would like to have the root account in safety even if my unprivileged user is compromised.
On Ubuntu you can only use sudo for "security reasons" by default. However I am not sure it is any safer ...
3
votes
1answer
126 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 ...
4
votes
4answers
398 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 ...
3
votes
2answers
779 views
`$XAUTHORITY` appears from 'nowhere' on su+tmux
When I switched from su+bash to su+tmux+zsh I noticed that I get $XAUTHORITY variable defined as /root/.xauthXXXXXX where XXXXXX are 6 random alphanumeric characters. With previous configuration X ...
9
votes
2answers
2k 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
487 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
1k 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
453 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
...
57
votes
2answers
5k views
Why do we use su - and not just su?
I don't understand why su - is preferred over su to login as root.
1
vote
2answers
2k 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 ...
1
vote
3answers
374 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:
...
4
votes
2answers
2k 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
889 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
424 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
294 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?

