Editing X inside VE
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
− | There are several ways to run X applications inside your [[ | + | There are several ways to run X applications inside your [[VE]]. |
== X forwarding == | == X forwarding == | ||
Line 5: | Line 5: | ||
=== Single application === | === Single application === | ||
− | To run an X application inside a [[ | + | To run an X application inside a [[VE]], one need simply to connect to a VE with '''ssh -X''': |
<pre> | <pre> | ||
host# ssh -2 -c blowfish -X user@address | host# ssh -2 -c blowfish -X user@address | ||
</pre> | </pre> | ||
− | After login to | + | After login to VE check that <code>$DISPLAY</code> variable is set and X11 forwarding is enabled: |
<pre> | <pre> | ||
ve# echo $DISPLAY | ve# echo $DISPLAY | ||
Line 16: | Line 16: | ||
</pre> | </pre> | ||
− | In case <code>$DISPLAY</code> is not set, make sure that X forwarding is enabled in <code>sshd</code> config inside | + | In case <code>$DISPLAY</code> is not set, make sure that X forwarding is enabled in <code>sshd</code> config inside VE. In most Linux distros sshd configuration is stored in <code>/etc/ssh/sshd_config</code>. You should set parameter <code>X11Forwarding</code> to <code>yes</code>. Also VE should contain <code>xauth</code> package, thus install <code>xauth</code> if it is missing (in Debian this is part of the xbase-clients package). After that, restart your sshd daemon: |
<pre> | <pre> | ||
ve# /etc/init.d/sshd restart | ve# /etc/init.d/sshd restart | ||
Line 23: | Line 23: | ||
{{Note|Don't forget to reconnect after this}} | {{Note|Don't forget to reconnect after this}} | ||
− | Now you can run X applications from your | + | Now you can run X applications from your VE: |
<pre> | <pre> | ||
ve# firefox | ve# firefox | ||
Line 47: | Line 47: | ||
== VNC for X desktop == | == VNC for X desktop == | ||
− | First, one need to run '''Xvnc''' server inside | + | First, one need to run '''Xvnc''' server inside VE. The easiest way for this is to run |
'''vncserver''' script. This scripts starts all the required services | '''vncserver''' script. This scripts starts all the required services | ||
and small http daemon which provides graphical web access to your desktop (via Java applet). | and small http daemon which provides graphical web access to your desktop (via Java applet). | ||
Line 62: | Line 62: | ||
using '''vncviewer''' command: | using '''vncviewer''' command: | ||
<pre> | <pre> | ||
− | host# vncviewer < | + | host# vncviewer <VE_IP>:1 |
</pre> | </pre> | ||
Line 71: | Line 71: | ||
=== Starting KDE desktop with VNC === | === Starting KDE desktop with VNC === | ||
To start KDE desktop instead of default twm one replace <code>twm &</code> line with <code>startkde &</code> in user's | To start KDE desktop instead of default twm one replace <code>twm &</code> line with <code>startkde &</code> in user's | ||
− | <code>~/.vnc/xstartup</code> file on the | + | <code>~/.vnc/xstartup</code> file on the VE. |
=== Connecting with VNC from firewalled network === | === Connecting with VNC from firewalled network === | ||
Line 100: | Line 100: | ||
Change your display settings (don't forget to change them back after you establish a connection) | Change your display settings (don't forget to change them back after you establish a connection) | ||
− | <pre>DISPLAY=:1 | + | <pre>DISPLAY=:1,0</pre> |
Forward your application or desktop over ssh to Xephyr | Forward your application or desktop over ssh to Xephyr | ||
Line 113: | Line 113: | ||
This method will give you a graphical login prompt remotely similar to VNC, but with some differences. Most notably, XDMCP is faster than VNC (due to the way each deals with screen handling) and but you CANNOT connect to existing sessions like you can with VNC. Each time you logout, your programs are closed. XDMCP is better suited in situations where you don't have a local display (or dumb terminals/clients) but want to run X11 programs | This method will give you a graphical login prompt remotely similar to VNC, but with some differences. Most notably, XDMCP is faster than VNC (due to the way each deals with screen handling) and but you CANNOT connect to existing sessions like you can with VNC. Each time you logout, your programs are closed. XDMCP is better suited in situations where you don't have a local display (or dumb terminals/clients) but want to run X11 programs | ||
− | === | + | === VE Configuration === |
Install your desktop environment as you'd like (kde/gnome/xfce/etc) and ensure you install at least XDM. You can opt to use GDM/KDM as they also do the same job as XDM. The configuration for KDM/GDM is different than XDM's and I was only able to find one link on configuring GDM (more below). | Install your desktop environment as you'd like (kde/gnome/xfce/etc) and ensure you install at least XDM. You can opt to use GDM/KDM as they also do the same job as XDM. The configuration for KDM/GDM is different than XDM's and I was only able to find one link on configuring GDM (more below). | ||
Line 126: | Line 126: | ||
(Please keep in mind the security implications by the above line. Read the comments found in the file and set it appropriately) | (Please keep in mind the security implications by the above line. Read the comments found in the file and set it appropriately) | ||
− | To provide the possibility to run sound applications from | + | To provide the possibility to run sound applications from VE, /dev/dsp device file needs to be exported in VE: |
<pre> | <pre> | ||
vzctl set 221 --devnodes dsp:rw --save | vzctl set 221 --devnodes dsp:rw --save | ||
</pre> | </pre> | ||
− | Finally, if you intend to make xdm invoking a heavy desktop like kde, it is reasonable to increase the amount of memory available for allocation inside this | + | Finally, if you intend to make xdm invoking a heavy desktop like kde, it is reasonable to increase the amount of memory available for allocation inside this VE: |
<pre> | <pre> | ||
vzctl set 221 --privvmpages 500M:600M --save | vzctl set 221 --privvmpages 500M:600M --save | ||
Line 137: | Line 137: | ||
For light desktop like icewm this is not needed. | For light desktop like icewm this is not needed. | ||
− | Once these changes have been made, start your xdm server by the appropriate startup script (typically similar to /etc/init.d/xdm start). That concludes the XDM setup in the | + | Once these changes have been made, start your xdm server by the appropriate startup script (typically similar to /etc/init.d/xdm start). That concludes the XDM setup in the VE. |
===== GDM ===== | ===== GDM ===== | ||
− | Edit the '''gdm.conf''' file and in xdmcp section, comment out the | + | Edit the '''gdm.conf''' file and in xdmcp section, comment out the 0=standard line under the [servers] section - this will prevent gdm from trying to launch an X server on the local machine - it will simply listen for xdmcp requests. Also, change from VCAllocation=true to VTAllocation=false and comment out the FirstVT=7 line. Change the access restrictions (if any) to suit your needs and then start GDM. |
− | === | + | === Hostnode Configuration === |
− | + | On the HN, you need to install ONLY a bare Xserver as per your OS instructions (use yum, emerge, apt, whatever). A desktop environment like XFCE/GNOME/KDE are entirely optional (and not recommended as it'll unnecessarily just chew up resources) on the HN. | |
− | On the | ||
To get access to the XDM server, just start an Xserver with '''X -query <remote IP> :0''' (where :0 is the local display...set to :1 if you already have an X session running, or use Xnest) | To get access to the XDM server, just start an Xserver with '''X -query <remote IP> :0''' (where :0 is the local display...set to :1 if you already have an X session running, or use Xnest) | ||
− | There are guides online on howto | + | There are guides online on howto tunnel the XDMCP settings over ssh giving you security, in an otherwise INSECURE protocol. |
=== Errata === | === Errata === | ||
− | On a side note, as of December 2007, I was never able to successfully get an Xserver to run inside a | + | On a side note, as of December 2007, I was never able to successfully get an Xserver to run inside a VE and have the display output onto virtual-terminal 7 (the Xserver default), However, you can get an Xserver running on the hostnode to display output on virtual-terminal 7 without any special configuration (as the hostnode has direct access to all necessary devices). |
− | |||
− | |||
− | |||
− | |||
− | |||
== External links == | == External links == | ||
− | |||
* http://forum.openvz.org/index.php?t=tree&th=235&mid=1115&&rev=&reveal= | * http://forum.openvz.org/index.php?t=tree&th=235&mid=1115&&rev=&reveal= | ||
− | * http://ait.web.psi.ch/services/linux/ | + | * http://ait.web.psi.ch/services/linux/kde-desktop-sharing.htm |
* http://ait.web.psi.ch/services/ssh/vnc-ssh.html | * http://ait.web.psi.ch/services/ssh/vnc-ssh.html | ||
* http://www.vnc.com/pipermail/vnc-list/2002-July/031831.html | * http://www.vnc.com/pipermail/vnc-list/2002-July/031831.html | ||
Line 171: | Line 164: | ||
[[Category: HOWTO]] | [[Category: HOWTO]] | ||
[[Category: Networking]] | [[Category: Networking]] | ||
− |