Some facts:
Launch X applications remotely via network
- X service accepts connections on port number 6000+display number, for example fourth display will be on 6004/TCP port.
- You can start X using startx script or XDMCP(X Display Manager Control Protocol) server, such as kdm, xdm or gdm.
- startx - bash script, is a front end to xinit that provides a somewhat nicer user interface for running a single session of the X Window System. It is often run with no arguments. It uses user's .xinitrc file.
- xinit - is used to start the X Window System server and a first client program.
- xterm - terminal for X enviroment
- When X application is started, it connects to X display(specified in DISPLAY environment variable). Display consists of three parts: host:display number:screen number, for example: osiris:0.0 If display number is zero, then application will connect to 6000 TCP port, if display number is 1, then to 6001 TCP port and so on....
Launch X applications remotely via network
Suppose, we want to launch gcalctool on computer A from computer B. First, wee need to allow connections to X server on computer B from network. To accomplish this, X server must be launched without "notcp" option. Usually X is started via display manager. For example, consider GDM. In GDM configuration file change DisallowTCP=true to false.
Next add computer A to acl on computer B:
xhost +A
Then login via telnet or ssh to computer A from computer B and change DISPLAY environmental variable:
export DISPLAY=B:0.0
After this launch gcalctool on computer A and you will see calculator on computer B :)
Encrypt X connections with SSH
SSH protocol can tunnel other protocols. It can be used to encrypt and compress X connections:
ssh -C -X user@server
After login, you can launch X applications. Using SSH is the most preferable way to launch X applications remotely. First it is secure. Second it is more comfortable: you don't need to use xhost, allow connections to X server and edit DISPLAY variable.
Tips
- Start another X server in virtual terminal 8
startx -- :1 vt8
- Reconfigure X server. In Debian:
/etc/init.d/kdm stopdpkg-reconfigure xserver-xorg
- In other distributions:
# cd /etc/X11/ && Xorg -configure
- Display information about X:
xdpyinfo
- Obtain detailed technical information about a specific window:
xwininfo
- Read all the fonts in the current directory and creates a fonts.scale file:
mkfontscale
- Combine the fonts.scale file with the fonts.dir file, creating it if it doesn’t already exist
mkfontdir
- Add the font path to a running system:
$ xset fp+ /your/font/directory$ xset fp rehash
- Select an X core font for display
xfontsel
- Cause Xft to run through its font directories and create index files:
fc-cache
- Select what XDMCP server to use, in Fedora: /etc/sysconfig/desktop file, in openSUSE: /etc/sysconfig/displaymanager, in Debian and Ubuntu via SysV startup script
- XDM’s main configuration file is /etc/X11/xdm/xdm-config
- Make screenshot of remote X server:
xwd -display 192.168.0.1:0 -root -out 192.168.0.1.xpm
Most graphic viewers can open xpm files.