Difference between revisions of "Switch users from terminal"
(categorize uncategorized page: Category:Security (English)) |
Kynikos.bot (talk | contribs) (remove language suffix from Category:Security (English), see Talk:Table of Contents#English Category Names: Capitalization and Conflict with i18n) |
||
Line 1: | Line 1: | ||
− | [[Category:Security | + | [[Category:Security]] |
{{Merge|Post Installation Tips|3=Talk:Post Installation Tips}} | {{Merge|Post Installation Tips|3=Talk:Post Installation Tips}} | ||
If you have more than one normal user account on a computer, you might find the need to run programs as the other user (instead of the user you are logged in as). | If you have more than one normal user account on a computer, you might find the need to run programs as the other user (instead of the user you are logged in as). |
Revision as of 18:34, 23 April 2012
If you have more than one normal user account on a computer, you might find the need to run programs as the other user (instead of the user you are logged in as).
In such a situation, the 'su' command comes in handy.
Let us assume that the two users are user1 and user2, and that you know the passwords for both users. Type the following if you are logged in as user1 and need to run a program as user2.
$ su user2 Password:
This is all you need if you are going to start a console application, however, if you are going to run a graphical program, you will need to tell the x-server that user2 has to be allowed to use X too.
Again, as user1 (the user you have logged in as), type one of the following commands
$ xhost user2 $ xhost +user2 $ xhost +
The first and second are synonymous to each other, while the third command allows any user or host to run a program that requires x-authority. For further details on the xhost program, see its man page.