XAUTHORITY=/home/user/.Xauthority gvim file1.txt
The old-school way of doing this was to tinker with xhost to
allow a whole host (rather than a particular user) to connect to
the X server.
The aim is to allow your alternate user (root in this case)
permission to connect to the X server so that it can access the
clipboard(s). My understanding is that the keys found in the
.Xauthority file are the way to do this...that the alternate user
has to have the key.
Or I could be talking bunk. YMMV :)
thanks a lot for that ! Simply: IT WORKS!
Other suggestions I've heard include, rather than *being* root,
to try (as "user")
[EMAIL PROTECTED] sudo gvim file1.txt
(assuming you have sudo configured to allow you to run gvim)
which for some reason should work as well. I've actually done
this one, whereas my previous ramble was 100% untested. I'm glad
it worked.
Other ideas I've heard include creating a soft-link:
[EMAIL PROTECTED] ln -s ~user/.Xauthority ~/.Xauthority
which doesn't work quite as well for non-root situations unless
you explicitly share your ~user/.Xauthority file permission-wise,
such as
[EMAIL PROTECTED] chmod ug+r ~/.Xauthority
[EMAIL PROTECTED] chown :alteregos ~/.Xauthority
[EMAIL PROTECTED] su -c user2
[EMAIL PROTECTED] ln -s ~user1/.Xauthority ~/.Xauthority
(those permissions *might* need to be "ug+rw", but I'm not sure
on that) This assumes that user1 and user2 are members of hte
"alteregos" group.
However, if you log in from [xkg]dm as user2 (or "startx" as
user2), it might try and overwrite user1's .Xauthority file,
which, if permissions aren't granted, might cause grief. Not
always a bad thing if only one person is logged on at a time, but
if you have "fast user switching" (which, in the implementations
I've seen, is done by running multiple X servers on multiple
consoles), you might have some trouble.
Just a few more ideas to play with.
-tkc