
Since sudo can pretty much do everything that su can, I would say it is best to stick with sudo unless you are working with some legacy codes that require the su command.In the Linux and UNIX environments, you need to use either SU or SUDO in order to gain momentary access to another account, usually the root, while logged on as another.
#SU VS SUDO PASSWORD#

Just typing su switches to the root user.su means to switch to a particular user.sudo -i brings you to an interactive session as root.You need to have an entry in /etc/sudoers to execute these restricted permissions.sudo lets you issue commands as another user without changing your identity.The ( -) switch has the same effect as logging into a system directly with that user account. If you want to switch to the bryant user account including bryant's path and environment variables, use the ( -) switch: $ su - bryant $ su bryantįor the second example, you are switching to bryant, and so you need bryant's password unless you are root. The ( -) switch provides you with root's environment (path and shell variables) rather than simply giving you root user power for a single command while keeping your own environment. In the above example, you are switching to root and you need the root password. Most often, the user account you switch to is the root account but it can be any account on the system. You are basically switching to a particular user and you need the password for the user you are switching to. Su, on the other hand, is an acronym for switch user or substitute user. The theory behind using sudo is that the act of issuing the sudo command before any command you run makes you think more about what you're doing and hopefully make fewer mistakes with an account that possesses unlimited power. Linux system administration skills assessment.A guide to installing applications on Linux.
#SU VS SUDO DOWNLOAD#
#SU VS SUDO INSTALL#
Instead, if you run this command: $ sudo dnf install nginx For example, if you want to install the Nginx package, you run: $ dnf install nginxīut you will see an error if you are not root or in the sudo group. To continue running commands with root power, you must always use the sudo command. Depending on your settings in the /etc/sudoers file, you can issue single commands as root or as another user.

Sudo, which is an acronym for superuser do or substitute user do, is a command that runs an elevated prompt without a need to change your identity. As you can imagine, errors made as the root user can be irreversible and devastating.

And, unlike other more chatty operating systems, you won't see a, "Are you sure?" dialog to be sure that the rm -rf * command you just issued was in /opt/tmp rather than at /. It is the all-powerful administrative account.
