The command works with the user "heo". But I get the error by "$ su another_user; cat file | xclip":
No protocol specified Error: Can't open display: :0.0
A superuser has black CLI, no error message or text, with the xauth-command.
-
How can I keep the same display with many users?
-
How can I change the display to :0 or :1 for all users?
-
Why is the xauth-command black with one superuser?
Best Answer
xclip can't talk to your X server. Check that $DISPLAY is set correctly. Do other X clients work with the same $DISPLAY setting?
This:
works just fine for me.
edit
You get the error after
su
'ing to another user because that user doesn't have appropriate permissions to connect to your X server. X uses a permission checking protocol known as MIT magic cookie, which works by creating a random string to use as a password. That password is stored in the file$XAUTHORITY
, or~/.Xauthority
if the environment variable is not set. It is manipulated by thexauth
tool. For example,I'm not sure what you're doing the su for, but:
$DISPLAY
to that user's display, and$XAUTHORITY
to that user's X authority file. Look into ConsoleKit (if you're using it) and/var/lib/gdm
(if you're using gdm) to find said things.If none of the above, then you'll have to use xauth to set up the authorization, and keep in mind that anything connecting to your X server can do all sorts of evil, such as watch all your keystrokes.
PS: The
$DISPLAY
refers to which X server they're logged in to. Unless you've set up multiple servers running (so multiple users may log in at once), it will be the same for all users.