On this page:
There are two primary commands to obtain root (adminstrative, superuser) privileges that you need to make system changes (e.g., installing software) using a terminal.
- su: requires root’s password and grants privileges for entire terminal session
- sudo: requires your own password and grants privileges for a single command
In addition, the command gksu is usually used in MX Linux to launch a graphical program outside a terminal (e.g., in a menu entry).
sudo is the default root access command in antiX-15 core, base and full.* sudo lets you run commands in your own user account with root privileges but keeps the environment (user-specific configuration) of the user issuing the command. It is generally considered more secure than su (see Links). sudo can be set to allow just a few commands to be run, by only some people, or a certain group, also it can 'time out'. For other uses, see this page.
The properties of sudo are stored in a file in /etc/sudoers.d/. To see what the settings are for your user name, open a terminal and type:
The sudoers file should be edited if necessary using visudo as root, which checks the syntax before saving any changes.
* Known exceptions: 1) clicking on the menu ControlCentre > System > Choose Startup Services brings up a terminal that needs the password of su, not sudo; 2) same need for SetTime.
gksudo is used to pop up the password prompt in a GUI window instead of on the command line, no matter whether the application is GUI or CLI.
antiX MX (MX Linux) uses a “true root,” meaning that the Manual and the Forum will generally instruct the use of su.* su lets you switch user so that you’re actually logged in as root and using the environment of the user root,
*Users who run KDE over an antiX base use kdesu instead of su.
MX Linux uses gksu to provide a graphical frontend to su that relies on the GTK libraries (as does Xfce itself). It sets HOME=~root, and copies .Xauthority to a tmp directory. This prevents files in your home directory becoming owned by root. (The command gksudo also exists, but usually has an identical function.)
pkexec -- allows an authorized user to execute a program as another user (based on Policy Kit)
su-to-root -- allows the user to be asked for the root password
sux -- transfers your X credentials to the target user.
The primary purpose of these commands is to run graphical applications that need root without the need to run an X terminal emulator and using su directly.