Linux Annoyances for Geeks: Getting the Most Flexible System in the World Just the Way You Want It
11.5. I Need to Run an X Application Remotely
Sometimes you need to run a GUI application but can't get to your computer. You may want to support users who need remote access to their applications. I'll assume that you've already set up Secure Shell (SSH) or VNC clients for these users. In this annoyance, I'll show you how you can configure secure remote access to your GUI applications. While you can use VNC, SSH is preferred, as it provides strong encryption, making it more difficult for a cracker to track your keystrokes. An SSH configuration means that you're networking only the GUI application that you happen to be running remotely, as opposed to a whole GUI desktop environment.
If you absolutely need remote access for GUI applications, keep it behind a firewall. If at all possible, don't open the firewall to external clients on the SSH ports. If you do, use the directives described in the following sections (and the previous annoyance) to minimize your risks. 11.5.1. Configuring the SSH Server for X Access
The configuration file for the SSH server is /etc/ssh/sshd_config. While it offers a substantial number of directives, most of the defaults configured on our target distributions don't need to be changed for SSH to work. However, these defaults may not be secure. Depending on your distribution, you may need to make a few changes. I suggest you pay particular attention to the following directives:
After saving changes to the SSH server configuration file, you'll need to restart the associated daemon. The name of the daemon may vary slightly by distribution; you can use the following command for Red Hat/Fedora and SUSE Linux: /etc/init.d/sshd restart
The appropriate command on Debian Linux is slightly different: /etc/init.d/ssh restart 11.5.2. Configuring the SSH Client for X Access
There are three ways to configure the SSH client to support networking of GUI tools and applications:
By default, any authorized user can log in to an SSH server, specifying access to GUI applications with the -X switch, e.g.: ssh -X michael@debian.example.com
But GUI access may not be secure. The most secure approach is to limit X access for all users on a client and then enable it for only the desired users. To do so, open /etc/ssh/ssh_config and set the following directives:
Next, on the ~/.ssh/config file for the user that you want to authorize, include:
11.5.3. Remote SSH Access to GUI Applications
Once configured, you can access remote GUI applications through the command line. To this end, you'll need to know the text commands that start GUI applications, such as /usr/bin/oowriter. Unless you're running a network with gigabit-level speeds, expect a bit of a delay as the application opens (and as it runs remotely on your workstation). |