Skip to main content
add a note about shell interpreter
Source Link
rozcietrzewiacz
  • 40.2k
  • 9
  • 98
  • 105

You can run commands as other users using su:

 su USERNAME -c COMMAND

Will run COMMAND with privileges dropped to USER.


Note that, by default, su will use the target user's shell interpreter to run the command. By contrast, the default behaviour of sudo is to treat the COMMAND as a standalone program, that is run the current environment. Of course these default behaviours can be changed with various switches and environment variables.

You can run commands as other users using su:

 su USERNAME -c COMMAND

Will run COMMAND with privileges dropped to USER.

You can run commands as other users using su:

 su USERNAME -c COMMAND

Will run COMMAND with privileges dropped to USER.


Note that, by default, su will use the target user's shell interpreter to run the command. By contrast, the default behaviour of sudo is to treat the COMMAND as a standalone program, that is run the current environment. Of course these default behaviours can be changed with various switches and environment variables.

added 32 characters in body
Source Link
rozcietrzewiacz
  • 40.2k
  • 9
  • 98
  • 105

Yes, withYou can run commands as other users using su:

 su USERNAME -c COMMAND

Will run COMMAND with privileges dropped to USER.

Yes, with su:

 su USERNAME -c COMMAND

Will run COMMAND with privileges dropped to USER.

You can run commands as other users using su:

 su USERNAME -c COMMAND

Will run COMMAND with privileges dropped to USER.

Source Link
rozcietrzewiacz
  • 40.2k
  • 9
  • 98
  • 105

Yes, with su:

 su USERNAME -c COMMAND

Will run COMMAND with privileges dropped to USER.