Stands for replace consumer. This command is used to change consumer and shall we exceuting command with the privilage of that consumer. It simplifies, normally for administrator, to regulate customers. As a substitute of logging to shell for separate customers and classes, admin can login with their very own account and turn to sepcific consumer with their username.

Common syntax for su command:

Login with a unique consumer account
su [username]

Cross the username to the su command, and it’ll supply a login consultation when the password has been verified.

Instance: Login with a unique username newone.

login diff accountlogin diff account
Login with a unique consumer account + run a command
su [username] -c [command]

The -c possibility lets you run a selected command below a unique consumer account and show the ends up in the present login consultation.

Instance: Operating the ls command below any other consumer account newone and showing it within the ubuntu login consultation.

login and run commandlogin and run command
Specify the shell
su -s /bin/[shell]

Use the -s approach to alternate an present default shell to another one.

Instance: The usage of the command to open the root consumer account within the Z shell (zsh).

specify shellspecify shell
Keep consumer account atmosphere
su –p [another_user]

The -p possibility lets you stay the surroundings of the present consumer account.

Instance: Switching username consumer to consumer newone. And showing the house listing to turn that it stays the similar.

preserve user acc envpreserve user acc env

The submit How to Use the SU Command in Linux gave the impression first on Hongkiat.

WordPress Website Development

[ continue ]