Difference between revisions of "Switch users from terminal"

From ArchWiki
Jump to: navigation, search
(Directions on how to log in as another user)
(redirected page to su)
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
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).
#REDIRECT [[su]]
In such a situation, the 'su' command comes in handy.
Let us assume that the two users are <i>user1</i> and <i>user2</i>, and that you know the passwords for both users. Type the following if you are logged in as <i>user1</i> and need to run a program as <i>user2</i>.
$ su user2
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 <i>user2</i> has to be allowed to use X too.
Again, as <i>user1</i> (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 <b>any</b> user or host to run a program that requires x-authority. For further details on the xhost program, see its man page.

Latest revision as of 03:17, 16 December 2012

Redirect to: