[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ssh + X11



Rodrigo Valenzuela <rvr@vtr.net> writes:

>hi everyone: When i connect via ssh to my computers it goes fine, but
>	when i tried 'startx ' it complains with 'X: user noy
>	authorized to tun the x server'.  Obviously the user can startx
>	with no complain when sitting in front of the computer, so it
>	is authorized.  What is missing? Any comments? Pointers?


Hey, startx is meant for local use only. If you want to remotely display
an X app, just use ssh X11 forwarding (option -X, and also add -C for
compression). It will set the DISPLAY and authorization stuff in a
glimpse, so your X apps are effortlessly displayed through the network.

To start a remote session (so your local machine behaves like a
graphical terminal), you have to tell xdm(1) where your server is, and a
few more things maybe.

>ps: is this the best option in order to access my desktop remotely, and
>do all the stuff I'm used to?
>thanks in advance

It seems that you're looking for something to re-attach yourself at a
display you left running; this is what I do to take control of my gf's
PC (without asking her to write any command, that wouldn't be easy ;-):

If your remote desktop is already running (X started with `startx'
locally), you can start a vnc server in that display, and access it via
a ssh tunnel, very easily:

# first, login with X11 forwarding enabled and  tunneling the vnc port
user@localmachine$ ssh -XC -L 5900:remotemachine:5900 remotemachine
user@remotemachine password: ******

# run x0rfbserver just to configure and setup a password
user@remotemachine$ x0rfbserver 
# x0rfbserver is now displayed at localmachine's display, set it up,
# save and exit

# now the trick: get the rights to start an X app in the remote machine's
# display (usually :0)
user@remotemachine$ export XAUTHORITY=~/.Xauthority
user@remotemachine$ export DISPLAY=:0

# now start x0rfbserver, which is already configured, and leave that
# xterm alone for a while...
user@remotemachine$ x0rfbserver
[...gibberish...]

# finally, open the vnc session in you LOCAL machine as it were running
# just there:
user@localmachine$ xtighvncviewer 127.0.0.1

Next time, you won't need to set up the password again, so X11
forwarding and x0rfbserver can be skipped. Also, check xtightvncviewer's
"encodings" and "bgr233" parameters if your connection is too slow.

I hope this helps you.

... y Feliz Dieciocho! :-D

-- 
Cristian Gutierrez                                 Linux user #298162
crgutier[@]dcc.uchile.cl           http://www.dcc.uchile.cl/~crgutier

`Naturally, a sysadmin's entire person is holy.  We have the power to
kill daemons.' -- Mike Sphar



Reply to: