12/9/2023 0 Comments Su vs sudo![]() ![]() Example 1: Running a command with updated environment variables Let's take a look at some examples of when using su – can be more beneficial than just su. For example, if you need to run a process that requires more open files than current user account is allowed, you can use su – to switch to root account and have access to more resources. This can be useful if you need to run a command that requires more resources than current user account is allowed. When you use su –, new shell environment will also have target user's resource limits and ulimit values. For example, if you need to edit a file that is located in target user's home directory, it is easier to just use su – and have home directory already set as current working directory. This can be useful if you need to perform operations that require access to target user's home directory. When you use su –, new shell environment will have target user's home directory as its current working directory. However, if you use su –, new shell environment will have updated PATH variable, and command will be found. If you just use su, command will not be found because PATH variable has not been updated to include directory. For example, let's say you need to run a command that is located in a directory that is not in system's PATH variable. This is useful if you need to run commands that rely on specific environment variables. Environment VariablesĪs mentioned above, su – creates a new shell environment with target user's environment variables. ![]() Let's explore some of these reasons below. There are several reasons why using su – can be more beneficial than just su. This means that any changes made to environment variables, such as PATH or HOME, will be applied to new shell. The su – command, on other hand, not only switches to target user account but also creates a new shell environment with that user's environment variables. Once you enter correct password, you are granted access to that user's account. When you type su followed by name of user you want to switch to, system prompts you for password of that user. The su command is used to switch to another user account on system, typically root account. In this article, we will explore reasons behind using su – and provide examples of how it can be beneficial. However, in some cases, it is recommended to use su – instead of just su. One of most common tasks performed by system administrators on Linux systems is to switch to root user account using su command. The Linux operating system is a powerful tool that offers a wide range of features and functionalities to its users. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |