login will be read and executed by the shell. This means that login-specific resource files such as. This article has explained the difference between ‘su -‘ and ‘su root’ commands in Linux. sudo -i It is nearly the same as sudo su - The -i (simulate initial login) option runs the shell specified by the password database entry of the target user as a login shell. Once you enter the password, it is switched to the root user. Intro Difference between 'sudo' and 'su' command in Linux Bryant Son 598 subscribers Subscribe 6.5K views 2 years ago Linux Watch this video to find out the difference between 'sudo' and 'su'. Both commands prompt to enter the root user password. ![]() In Linux, the “ su –” is utilized to switch to a user account with a login shell session, and the “ su root” switches to the root user account without a login shell. This command is often used to perform administrative tasks as the root user without affecting the current environment.It requires the user to enter the root user’s password to authenticate.This command switches the user to the root user account without changing the current environment variables or the current directory.This command is often used to execute commands as the root user.It also changes the current directory to the root user’s home directory.This command switches the user to the root user account and sets the environment variables to those of the root user.The significant differences between the two are: su – Commands The “su -” and “su root” commands in Linux are used to switch to the root user account. Difference Between “su -” and “su root” Commands This also represents the difference between the su – and su root. The output above shows that the user has been switched to root but the home directory is of the current user. ![]() To switch to the root user and run a command with root privileges, use the basic “su -” command: Here are some examples of su – commands in Linux: Example 1: Switch to the Root User Using the “su -” Command It means that it loads the environment of the target user, including the home directory, PATH, and other environment variables. ![]() The “ su –” command is utilized to switch to the root user account and create a login shell session.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |