Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
There is a host S, and a client L, S has start X Window, and L doesn't. now I do this:
L$ xclock -display S:0 &
The window will be shown at S.
Then:
S# xhost -
to enable contrl list, the L will be refused the next time because it isn't on the list.
At last I want make a user on L could do this:
S$ xauth extract - $DISPLAY | ssh -l USER L /usr/X11R6/bin/xauth merge -
But it still be refused. What's wrong? Is there any problem of my understanding?
I don't think that your initial statement is correct. A computer or terminal needs to have the x11r6 server running to be able to display the output on the screen. Also, without even a simple window manager, you will not have borders or menus displayed. ( I am referring to computer S now. ) The role of server/client is different than what many expect. The X11 server is what displays things on the screen, so it is the terminal machine running the server. The program running on the different machine is the client. Techically, both may need the server program running, but the remote machine doesn't need a window manager if it doesn't display anything.
There are security policies which may control the usage of xauth. Try reading /usr/share/doc/packages/pam/README.pam_xauth as well as the xauth man and info pages.
There is also a readme on x-windows access in the www.tldp.org web site. The NSA site has an x-windows security how-to that you could probably find using google.
But here I just want to test the authorization mechanism of X, in this condition, X11 Server is on host S(in fact i have start Gnome), and the client program xclock is on L, and L does not start X.
Now I can run xclock at L but display the window on S, is that OK? But this make every user on L could access S's X server, How can I make that only one user on L could do this?
You need to read up on how your system controls this. For many distro's the use of xauth is controlled by PAM. I already refered to the readme document for this. Other distro's such as Slackware do not use PAM. Here you would need to manually merge the magic cookie from ~/.Xauthority on host L to the ~/.Xauthority on host S.
A user's .Xauthority file is only readable by the owner.
A better way may be to use ssh with x-forwarding. The handing of the X-auth cookies and setting of $DISPLAY is handled in the background. I've only used ssh to run programs remotely. I have rarely pushed an output like that. I think I just did it once as an experiment. However, I've used ssh on my laptop to run a program on my desktop, while displaying the program on the laptop.
If you also want sound to be played on the remote rather than the local machine, there may be more work and setup for this.
The highlighted portions are new. This is based on a debian distro, but probably would apply closely to your situation ( unless your setup already has this in place )
"merge the magic cookie from ~/.Xauthority on host L to the ~/.Xauthority on host S", but when I do this on console:
L$ xauth nextract - $DISPLAY
xauth: (argv):1: bad "nextract" command line
Then I run X and xterm on L:
xterm$ xauth nextract - $DISPLAY
No matches found, authority file "-" not written
xterm$ xauth nextract ~/.Xauthority $DISPLAY
No matches found, authority file "/home/USER/.Xauthory" not written
You may have better luck following these instructions. I don't think you are transfering the cookie information from the S host to the L host. http://acs.ucsd.edu/info/xauth.php
Quote:
Giving another machine access
Set up .rhosts
To allow connections from another machine, first set up an .rhosts file on the remote machine. You've probably already done this before even thinking about figuring out xauth, but it's still important. The .rhosts file should contain the name of the local machine and your username on one line, separated by a space. This is the same file that you use to enable rsh, rlogin, and rcp. For more information on .rhosts files, see "help rcp".
Transfer the cookie
To transfer the cookie to a remote machine, set up the .rhosts file on that machine as described above, then type (replacing "remote" with the name of the remote machine you want to use):
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.