Solved How do I startx over ssh?

decuser

Active Member

Reaction score: 74
Messages: 216

I am trying to run X over ssh and would like to run the command startx, but I get this error:

Only console users are allowed to run the X server

I've dug around a bit and it seems either folks never want to do this or they're on linux and edit Xwrapper.conf to allow users to do this. For me, I'm reading Volume Three of the X Window Systems User Guide by Quercia and O'Reilly and I don't want to have to bring my FreeBSD laptop with twm on it into the room in order to experiment with stuff. Usually, I just run whatever commands I want via xterm and that still works fine. But, I want the root window and twm to play with in the other room :).

Is there a way around this in 12.1?

Goal:
ssh -Y astra
$ startx
twm in all its glory on the remote system.
 

Zirias

Daemon

Reaction score: 1,070
Messages: 1,933

I'm not sure what exactly you want, but startx will start an X server on the local machine, which doesn't make any sense over an ssh connection, as this X server would use local graphics hardware for display (so, you won't see anything on your client) and you already have your X server running on your remote machine (the ssh client). You can just start any X client via ssh and with the correct option for tunneling X, it will connect to your local (ssh-client-side) X server. Starting a window manager this way wouldn't make much sense as you probably already have one running locally.

If you want a full remote X session, you could go with the classic solution (read up on display managers and XDMCP) or use any alternative like VNC, RDP, etc.
 

Jose

Aspiring Daemon

Reaction score: 685
Messages: 790

AFAIK, you can't do this. What you want is a remote desktop on your laptop. Normal X forwarding allows remote applications to connect to your local X server to display on your local machine. You could try x11vnc. I believe it does what you want, but I've never used it.
 

Zirias

Daemon

Reaction score: 1,070
Messages: 1,933

Btw, if you insist doing that via ssh, you could have a look at x11-servers/xephyr. This is a "nested" X server that displays an X root window inside a client window (so, it is both an X server and an X client). But it probably won't give you great performance over ssh :)
 
OP
decuser

decuser

Active Member

Reaction score: 74
Messages: 216

but startx will start an X server on the local machine, which doesn't make any sense over an ssh connection, as this X server would use local graphics hardware for display (so, you won't see anything on your client) and you already have your X server running on your remote machine (the ssh client).

Well, when you say it like that it does sound pretty dumb :). I'll check into XDMCP.
 

Zirias

Daemon

Reaction score: 1,070
Messages: 1,933

Well, when you say it like that it does sound pretty dumb :). I'll check into XDMCP.
I didn't imply it was "dumb", just trying to explain why it doesn't make sense, so, IOW, I understand how you got the idea and you just didn't think it completely thru -- this happens :D

As for XDMCP, be warned, this is a "very classic" solution for a remote X session. I've seen it in use in the early 2000s on some AIX workstations at my university ;) It lacks any encryption and compression (so, only use it in a secured LAN and don't expect great performance)

Nowadays, either VNC or RDP is probably the better solution for a "remote desktop" on a *nix machine.
 
OP
decuser

decuser

Active Member

Reaction score: 74
Messages: 216

Btw, if you insist doing that via ssh, you could have a look at x11-servers/xephyr. This is a "nested" X server that displays an X root window inside a client window (so, it is both an X server and an X client). But it probably won't give you great performance over ssh :)

Nice, it 'worked' but boy is it slow :). Here's what I did:
sudo pkg install xephyr
Xephyr -br -ac -noreset -screen 800x600 :1
DISPLAY=:1 twm

If it wasn't so laggy, it'd be perfect. Is there a non-ssh way that'd be faster? This is all behind a firewall and it's not a workstation. So I'm not terribly concerned about the ip traffic between the laptop and FreeBSD system being monitored.
 

Zirias

Daemon

Reaction score: 1,070
Messages: 1,933

Well, the non-ssh way is to use an XDMCP-aware display manager on your client (like e.g. the classic x11/xdm), configure it accordingly so you can launch a remote X session (it has a "chooser" for the user to pick on which remote machine he wants to log in) and have your remote X "full screen" that way. But I wouldn't expect it to perform a *lot* better ;)

If you need your remote desktop in a window of your local desktop, it's really gonna be either VNC or RDP (see for example net/x11vnc and net/xrdp)
 

trev

Aspiring Daemon

Reaction score: 257
Messages: 973

I use /net/tightvnc remotely 500K away over a 12/1 Mbps FTTB connection with x11-wm/twm and it is plenty fast enough, so I think you'll find it fast enough in the "other room".
 
OP
decuser

decuser

Active Member

Reaction score: 74
Messages: 216

tightvnc works, and it's not that slow. I think that'll work for now:

On the FreeBSD machine:
vncserver

On the laptop:
RealVNC viewer
Server: astra:1

Off to go figure out how to modify xstartup to match my xinitrc setup (I don't suppose I can just copy it over...?)
 

jmos

Active Member

Reaction score: 108
Messages: 143

Additional to the things already said: Running one simple X11 program can be done via SSH directly; Example:
ssh -X user@machine xterm
(…and such a remote xterm can start other applications from the remote machine, too.)
 
Top