What are the differences between “su”, “sudo -s”, “sudo -i”, “sudo su”?

1
su
switch user -- with no args provided, it switches (or attempts to switch) to root. Password authentication is required, unless you are already root.

Examples:
$ su # switches to root (requires root password)
$ su bob # switches to bob (requires bob's password)
# su bob # switches to bob (no password, because already root)

sudo
super-user do -- run a command with elevated permissions, without changing your identity. You must be part of the "sudo" group, typically, otherwise the incident gets recorded in a log file.

passing it a "-i" argument makes it an interactive session (ie. you switch to root)
passing it a "-u" argument runs it as a particular user (ie. instead of root)

The big difference between sudo and su here is that sudo uses *YOUR PASSWORD* to authenticate, whereas su uses *THEIR PASSWORD* (the account you're switching to)

Examples:
$ sudo rm /some/important/file # Removes /some/important/file regardless...

0 0
2
...
0 0
3
newbie question: whats the difference between "su root", "su" and "su &quo

location: linuxquestions.com - date: March 19, 2005
with all of them i get a password prompt for root, is there any difference between them?

What's the difference between “su” with and without hyphen?

location: linuxexchange.com - date: July 26, 2012
I'm quite new to Linux terminal and I'm not quite sure what the difference between su with a hyphen and su without a hyphen is, for example: su - username vs. su username. I looked into the documentation but in there, this was not mentioned. Could someone please help me out?

Difference between sudo su and sudo s

location: ubuntuforums.com - date: November 15, 2008
Hello, I am curious as to what the difference between sudo su and sudo -s are. As far as I can tell, they both make you root. Thanks.

Difference between su and sudo su

location: linuxquestions.com - date: September 13, 2012
Hi, I know what su...

0 0
4

pbrun is part of powerbroker server that symark and sun teams provides for advanced root privilege delegation and keylogging..

this application provides delegate privileges (usually root) to other users and log all events related all audits with advanced features and centralized all its.

also you can apply security policy your servers that is powerbroker agent.so pbrun makes everything via central (powerbroker) master host server..

you want to run chown or su command with pbrun on your host , pbrun sends to pb agent on master server and then master server recives this request and

processes this to according to policy files on the master server.if request is ok then master server returns "accept command information" to agent and

pb agent run your command.

and you can run sudo on solaris with your host also for run command as admin(root) or another user.

regards
...

0 0
5
superuser.com

I've setup the .ssh/authorized_keys and am able to login with the new "user" using the pub/private key ... I have also added "user" to the sudoers list ... the problem I have now is when I try to execute a sudo command, something simple like: $ sudo cd /root it will prompt me for my password, which I enter, but it doesn't work (I am using the private key password I set)Also, ive disabled the users password using $ passwd -l user I am trying to harden my system ... the ultimate goal is to use pub/private keys to do logins versus simple password authentication. I've figured out how to set all that up via the authorized_keys file.Additionally I will ultimately prevent server logins through the root account. But before I do that I need sudo to work for a second user (the user which I will be login into the system with all the time). For this second user I want to prevent regular password logins and force only pub/private key logins, if I don't lock the user...

0 0
6
...
0 0
7

The main difference between these commands is in the way they restrict access to their functions.

su (which means "substitute user" or "switch user") - does exactly that, it starts another shell instance with privileges of the target user. To ensure you have the rights to do that, it asks you for the password of the target user. So, to become root, you need to know root password. If there are several users on your machine who need to run commands as root, they all need to know root password - note that it'll be the same password. If you need to revoke admin permissions from one of the users, you need to change root password and tell it only to those people who need to keep access - messy.

sudo (hmm... what's the mnemonic? Super-User-DO?) is completely different. It uses a config file (/etc/sudoers) which lists which users have rights to specific actions (run commands as root, etc.) When invoked, it asks for the password of the user who started it - to ensure the...

0 0
8

To explain this you need to know what the programs do:

su - The command su is used to switch to another user (s witch u ser), but you can also switch to the root user by invoking the command with no parameter. su asks you for the password of the user to switch, after typing the password you switched to the user's environment.

sudo - sudo is meant to run a single command with root privileges. But unlike su it prompts you for the password of the current user. This user must be in the sudoers file (or a group that is in the sudoers file). By default, Ubuntu "remembers" your password for 15 minutes, so that you don't have to type your password every time.

bash - A text-interface to interact with the computer. It's important to understand the difference between login, non-login, interactive and non-interactive shells:

login shell: A login shell logs you into the system as a spiecified user, necessary for this is a username and password. When you hit ctrl+alt+F1...
0 0
9

If you’re a Linux user, you’ve probably seen references to both sudo and su. Articles here on How-To Geek and elsewhere instruct Ubuntu users to use sudo and other Linux distributions’ users to use su, but what’s the difference?

Sudo and su are two different ways to gain root privileges. Each functions in a different way, and different Linux distributions use different configurations by default.

The Root User

Both su and sudo are used to run commands with root permissions. The root user is basically equivalent to the administrator user on Windows – the root user has maximum permissions and can do anything to the system. Normal users on Linux run with reduced permissions – for example, they can’t install software or write to system directories.

To do something that requires these permissions, you’ll have to acquire them with su or sudo.

Su vs. Sudo

The su command switches to the super user – or root user – when you execute it...

0 0
10
...
0 0
11

There isn't any reason to use sudo or su to run the MySQL command-line client. It defaults to using your current Unix user as your MySQL user, but instead you should pass it the user you want to connect to as arguments:

$ mysql -u root # connect as MySQL's root user (without password) $ mysql -u root -p # -p means prompt for a password

Hopefully, your MySQL root account has a password, and you'll need to use the second form.

Other than that, if you need to run MySQL under sudo (e.g., for file permissions) then do it like this:

$ sudo -u unix-user mysql -u mysql-user -p

You can leave out the arguments (sudo will default to user root, MySQL will default to using the same user as...

0 0
12

Background

In Linux (and Unix in general), there is a SuperUser named Root. The SuperUser can do anything and everything, and thus doing daily work as the SuperUser can be dangerous. You could type a command incorrectly and destroy the system. Ideally, you run as a user that has only the privileges needed for the task at hand. In some cases, this is necessarily Root, but most of the time it is a regular user.

su -

This command is used to login at root account.
By default, the Root account password is locked in Ubuntu. This means that you cannot login as Root directly or use the su command to become the Root user. However, since the Root account physically exists it is still possible to run programs with root-level privileges. This is where sudo comes in - it allows authorized users (normally "Administrative" users) to run certain programs as Root without having to know the root password.

See How to Enable Root Account.

sudo sh

This...

0 0
13

In all Unix systems, including Linux a Superuser is the system user who has all permissions to be able to perform administrative tasks. This can be the user root but this user is diabled in Ubuntu for security reasons.

The Ubuntu way to perform admistrative tasks is to temporarily gain superuser privileges by putting the command sudo (super user do) in front of another command that requires superuser powers:

sudo dpkg -i packagename.deb

Then you will be asked for your password (which is identical to your login password):

[sudo] password for lasse:

Note that you don't see anything in terminal while typing this passoword (not even asterixes).

Users that are allowed to be administrators on creation of their account are put on a list of sudoers to enable the system to look them up before granting administrative privileges with sudo.

For further reading and alternative ways on how to become superuser or root see:

Please also note that you can...

0 0
14

Note: For help with configuring sudo privileges via its configuration file /etc/sudoers, please see Sudoers.

In Linux (and Unix in general), there is a SuperUser named root. The Windows equivalent of root is the Administrators group. The SuperUser can do anything and everything, and thus doing daily work as the SuperUser can be dangerous. You could type a command incorrectly and destroy the system. Ideally, you run as a user that has only the privileges needed for the task at hand. In some cases, this is necessarily root, but most of the time it is a regular user.

By default, the root account password is locked in Ubuntu. This means that you cannot login as root directly or use the su command to become the root user. However, since the root account physically exists it is still possible to run programs with root-level privileges. This is where sudo comes in - it allows authorized users (normally "Administrative" users; for further information please refer to...

0 0