How to use su command

Configurare noua (How To)

Situatie

Solutie

The switch user or su command allows you to run a program as a different user. It changes the administrative account in the current log-in session. This command is especially beneficial for accessing the system through SSH or using the GUI display manager when the root user is unavailable.

Here’s the general syntax of the command:

su [options] [username [argument]]

When executed without any option or argument, the su command runs through root privileges. It will prompt you to authenticate and use the sudo privileges temporarily.

Here are some acceptable options to use:

  • -p or –preserve-environment keeps the same shell environment, consisting HOME, SHELL, USER, and LOGNAME.
  • -s or –shell lets you specify a different shell environment to run.
  • -l or –login runs a login script to switch to a different username. Executing it requires you to enter the user’s password.

Tip solutie

Permanent

Voteaza

(2 din 3 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?