What is the purpose of su command?

What is the purpose of su command?

Change user ID or become superuser
su/Function

What is in su command?

The su command is used to switch to another user, in other words change user ID during a normal login session (that is why it is sometimes referred to as switch (-) user by a number of Linux users). If executed without a username, for example su – , it will login as root user by default.

What is su account?

The su (short for substitute or switch user) utility allows you to run commands with another user’s privileges, by default the root user. Using su is the simplest way to switch to the administrative account in the current login session.

What happens when you run the SU Command?

You will be prompted to enter the root password, and if authenticated, the user running the command temporarily becomes root. The session shell ( SHELL) and home ( HOME) environment variables are set from substitute user’s /etc/passwd entry, and the current directory is not changed. To confirm that the user is changed, use the whoami command:

Can a su command switch to a root user?

However you can switch to root by running the following command and entering the currently logged-in user’s password: The su command lets you switch the current user to any other user. If you need to run a command as a different (non-root) user, use the –l [username] option to specify the user account.

What happens when Su is invoked without an option?

When invoked without any option, the default behavior of su is to run an interactive shell as root: You will be prompted to enter the root password, and if authenticated, the user running the command temporarily becomes root.

What’s the purpose of using Su in Linux?

Linux su allows you to temporarily substitute users. Purpose – Learn what su is for and how to find help. Options – Review a few common options and arguments. Examples – Walk through code examples with su. A tip – Finish off with one more insight.