Copy to another custom clipboard -Xorg linux

I have a primary user that X runs under: username1. I have another user account that I work a lot in, username2.
How to make it so that I can copy the output of a command from userame2 to the username1s clipboard.

Here is an example of this failure:   

username2 $ echo "hello" |xclip
    No protocol specified
    Error: Can't open display: :0

After looking online, I found that I had to change the DISPLAY variable.
Here is what I get after making the changes:   

username2 $ echo "hello" |xclip
    Error: Can't open display: myws:0

When searching, I also see that there may be something that I need to do with my .Xauthority file; however, I am not familiar with him. I will continue to review the documentation.

Any recommendations would be greatly appreciated.

+3
source share
1 answer

. , , (, , ), root. , ( 2) root (, sudo).

username2 $ export DISPLAY=:0
username2 $ export XAUTHORITY=/home/username1/.Xauthority
username2 $ echo "hello" | sudo xclip

username2 DISPLAY :0, X , . username1, echo $DISPLAY , , w who, .

XAUTHORITY=/home/username1/.Xauthority /. _2 , root, , ( username1 chmod a+r ~/.Xauthority ).

: Ubuntu 12.04 LTS

0

All Articles