What does the su command do?

I just noticed it by typing random letters in. What does it do?

What does it do? Can someone tell me?

su means Substitute User
It allows to go on the user specified after su (assuming you know it’s password)

What? What does it do on Glitch?

1 Like

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. Additionally, su can also be used to change to a different shell interpreter on the fly.
SU Command in Linux: How to Use With Examples {2021 Tutorial}

2 Likes

Ie. If you where root and you wanted to switch to “admin” you would run:

su - admin

1 Like

su is a tool on these operating systems that support multiple users. It does what the documentation says it does, something about letting you temporarily log in as another user.

The operating system that Glitch uses supports multiple users, although the way Glitch uses containers makes the feature a lot less prominent. Each project gets its own container where it runs as the app user. Thus there really isn’t anything for us users to do with su.

It does serve at least some purpose in the big picture though. Glitch actually does have another user in the container, called root, which it uses to run some infrastructural services, such as the piece of code that handles when you open the project console and launches a shell process. Now that’s a place where the need for su comes up: the handler program, as a piece of infrastructure happens to run as root, but the shell should run as app. So it uses su to do that there.

3 Likes