Article 530M3 Running program as another user from the command line not working

Running program as another user from the command line not working

by
peter7089
from LinuxQuestions.org on (#530M3)
I am using Xubuntu and i am trying to run programs as another user from the command line, but it's not working. I have two users - user1 and user2. I am logged in as user1 and if i switch to user2 with the command `su user2` and try to launch a program, for example `mousepad` i get this:

Code:No protocol specified
Unable to init server: Could not connect: Connection refused
Cannot open display:The same happens with other programs if i try to launch them as `user2`, just with different error messages.

Why is this happening? Is it possible to run programs as `user2` from the command line?latest?d=yIl2AUoC8zA latest?i=R81xVtqmspI:ogk2DekFl60:F7zBnMy latest?i=R81xVtqmspI:ogk2DekFl60:V_sGLiP latest?d=qj6IDK7rITs latest?i=R81xVtqmspI:ogk2DekFl60:gIN9vFwR81xVtqmspI
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments