Changing your identity with su

Occasionally, you may need to log in with a userid other than your own or need to re-log in with your own userid. For example, you might want to check configuration settings that you've changed before logging out to make sure that they work. Or, if you change your shell, you might want to check it before you log out (and you should, by the way).

You can use the su (substitute user) command to either log in as another user (Code Listing 3.13) or to start a new login shell.

Code Listing 3.13. Changing back and forth from one user to another (and exiting from multiple shells) can get a little confusing, but the prompt often tells you who you are and what directory you're in.
 [ejr@hobbes asr]$ ls Projects testing [ejr@hobbes ...

Get Unix: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.