You can “become” another user to gain their privileges.
In the absence of having another user change permissions, another way you can get permission to a file is to log in as that user. Of course, you can only do this if you know the other user’s password.
To become another user, use the su command. The su command is the same one that administrators use to become the superuser. However, it isn’t just for a superuser: su stands for “switch user,” and can be used to become any other user.
For example, if lois knows jimmy ’s password, she can type:
% su jimmy
Password:Once she types in Jimmy’s password correctly, Lois can work as if she were Jimmy. Lois’s prompt may not have changed, but as far as UNIX is concerned, she is working as Jimmy. For example, if she creates a new file, the new file will belong to jimmy.
Although you can do whatever you want as Jimmy, you should respect his privacy. Don’t start looking at his personal files. And rather ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access