How To Run X Over SSH
To run X over SSH:
-
Add
allowed_users = anybody
to/etc/X11/Xwrapper.config
:echo 'allowed_users = anybody' |tee /etc/X11/Xwrapper.config
-
The virtual terminal used by X must be readable and writable by the user that is starting X. Normally permissions for an in-use tty are
crw-------
, owned by the user that logged in via it, e.g.:% ls -l /dev/tty? crw--w---- 1 root tty 4, 0 Jan 29 05:01 /dev/tty0 crw------- 1 me tty 4, 1 Feb 28 14:25 /dev/tty1 crw--w---- 1 root tty 4, 2 Jan 29 05:01 /dev/tty2 ...
Here, /dev/tty1
is used by me
while /dev/tty0
and /dev/tty2
are
unused.
The issue here is that merely adding the user you want to run X as to
tty
group is insufficient, as the group permission is write only and
does not grant read access.
So, we need to somehow change ownership of a chosen terminal to the user that would start X.
The interactive way:
# chown me /dev/tty8
% startx -- vt8
Here, I place X on VT8, and prepare /dev/tty8
by changing its ownership
to the user I plan on running X as.
This could be accomplished via udev rules on a permanent basis.