April 19, 2019

Remote Administration of Linux Systems - page 4

Introducing Remote Adnministration

  • August 27, 2002
  • By Alexander Prohorenko

As a rule, you don't need X Window on your server. It's pretty undesirable because of security reasons and certainly not for wasting server resources to support graphics. But in some cases, we will need a graphic console running on the server. A big example: installing and configuring Sybase SQL.

Sometimes an administrator needs to execute only a few specific graphic applications on the remote computer--for example, monitoring system or configuration utilities. In this case, we can easily use the method described here (which can also be automated with the help of shell scripts).

It is a pretty sure thing that you will have to have the Xfree-libs package pre-installed on both machines to handle this operation. YOu may also need additional libraries, depending on the application being accessed.

For example, on the administrator's computer X Window is running on the null graphic console (variable DISPLAY=:0.0). So, we will need to do the following:

  1. Run xterm or any other similar application (konsole for KDE, gnome-terminal for GNOME, etc.)
  2. Type the command
    xhost +

    where is the IP address of the remote computer.

  3. Log in with telnet or ssh to remote computer
  4. Type the command
    xterm -display

    where the argument display is the same as the variable DISPLAY and is the IP address of localhost.

In some cases you may still need to set the variable DISPLAY.

There will be some cases when an administrator needs to get acess to a full graphical console, such as when he is working directly behind a remote computer. For this purpose we can use a VNC package - Virtual Network Computing. It allows us to open a remote PC desktop window on our local desktop.

To configure vnc we need to follow next steps:

On remote PC:

  1. In file /etc/sysconfig/vncservers we need to append next string:

    where user is the username on the remote computer and the number (0) is the number of the graphic console. We need to mention that if we have running X Window on the remote computer, this will mean that graphic console 0 is already used and we should use 1 (or higher).

  2. Run the vncpasswd tool with username rights:
    Note: If a password isn't set, vncserver will not executed properly.
  3. Run the vncserver service and turn on the autoloading mode upon system load:
    service vncserver start
    starting vncserver: 0:user                                       [  ��  ]
    chkconfig vncserver on

On the administrator's workstation we can run vncviewer (this application requires X Window to be running). In the just-opened window we will type the IP address and number of the graphic console on the machine running vncserver. A new window with a running X Window session will appear.

vnc has a few notes, which we will need to remember.

  • From the point of view of a standard application - vncserver (to be more exact, Xvnc) works absolutely like the X server. And, if we run any application on any remote computer via the telnet utility, it will be perfectly displayed with vncviewer. We just need to make sure to set the DISPLAY variable correctly (or application argument -display).
  • During vncserver startup, the script ${HOME}/.vnc/xstartup is executed, too. By default, this script executes /etc/X11/xinit/xinitrc, which means that the specified window manager will also be started (just like in a regular X server), but on the local console of the remote computer you will not be able to see anything. From one point of view, this will speed up the remote computer connection process but from another, we will waste the system resources of the remote computer.

Most Popular LinuxPlanet Stories