قالب وردپرس درنا توس
Home / Technology / Linux 101: The different types of sudo and su

Linux 101: The different types of sudo and su



Knowing which sudo or su command to run is important. Jack Wallen demystifies these two Linux administration tools.

linuxhero2-1.jpg

Image: iStock / Spectral-Design

If you̵

7;re a new Linux administrator, you probably know at least about sudo. Sudo stands for “super user do” and allows standard users to take actions at the administration level, such as installing software. Although most every Linux distributions use sudo, some of them (like Fedora and openSUSE) let you su (change user) to the superuser account – otherwise known as root.

There are different ways to use sudo and su. Let’s remove the mystery.

If you issue the command su, you switch the user to root which then only runs the .bashrc file owned by root. Execute the command su – and you invoke a logon shell after switching users, which resets most environment variables and provides a clean base.

SEE: Linux file and directory management commands (TechRepublic Premium)

If you use only sudo, execute a command with administrator privileges. If you run the command sudo su – you want to switch to the root user who then runs all / etc / profile, .profile and .bashrc files by root, but only if the user running the command is defined in the / etc / sudoers file, and effectively becomes the root user, even if the root user is disabled, as it is in Ubuntu.

Finally, if you issue the command sudo su, you switch to the root user, without resetting the environment variables, so you have the root user rights, but not the environment. Often you just need to run the basics sudo or su commands. However, if it is a command, you must run it and it will fail with a minimum sudo command, either sudo – or sudo su – will always work.

Only use these commands with care so that you do not end up destroying the Linux desktop or server.

Subscribe to TechRepublics How To Make Tech Work on YouTube for all the latest technical advice for professional professionals from Jack Wallen.

See also


Source link