»   »   »

Administering a Redhat Linux Server from Windows

Prelude

I put this document together for my Windows-centic fellow administrators who needed a few pointers on working with Redhat Linux, and are generally more comfortable with graphical tools.

X-Server

If you are going to run any graphical tools on the Redhat (which is likely for many 3rd-party applications), you're going to need an X-Server. One of the most popular free X-Servers can be installed by Cygwin (an environment and collection of unix tools for Windows).

First create the Cygwin directory:

md c:\cygwin

Then download setup.exe from Cygwin into c:\cygwin

Start -> Run -> c:\cygwin\setup.exe

Make sure "Local Package Directory" is c:\cygwin, and choose a mirror that is close to where you are.

Click the small "View" button for "Full"

Select the xorg-x11-base package, which is located in the X11 category. The xorg-x11-base package is a helper package that automatically selects a working set of packages for you that will allow Cygwin/X to work. Then continue with the install, depending on what you selected, and your connection speed, this could take a while.

For a more thorough install document, take a look here.

Once the install is complete, open the Cygwin command-prompt, and type: sh /usr/X11R6/bin/startxwin.sh to start the X-Server.

Connecting to the Redhat Server

By default, most Redhat servers have the telnet service (daemon) turned off, and the ssh daemon turned on. You'll need a ssh client to connect to your server. You can install the Cygwin ssh client, or (my favorite) PuTTY.

To get graphical utilities to your X-Server, you're going to have to modify your PuTTY settings; Once you have entered your server name or ip-address, change the SSH -> X11 settings: Check the "Enable X11 forwarding" box, and type localhost:0 into the "X display location". Don't forget to go back to "Session" and save your changes.

To test, use PuTTY to connect to your Redhat server, and type xclock. If a clock appears, you have successfully got X-Windows applications to run on your X-Server from your Redhat server.

Another X-Window Forwarding Method

PuTTY is nice to use, but sometimes, if the data being tunneled through it is large, it can give a CRC error and die. But there is another method you can use. With the Cygwin setup (see above), you can install ssh, then once you have started your X-Server from your Cygwin session (see above), type the following:

export DISPLAY=127.0.0.1:0.0
xhost ServerName
ssh UserName@ServerName
    

Substitute UserName and ServerName for the server you're trying to connect to, you could also type xhost+ for the unsecured version. Then, once you have connected, type:

export DISPLAY=MyIPAdddress:0.0
    

Substituting MyIPAdddress with your own IP Address. Then to test that it works, type xclock.

The Command-Line

I have written a document here that covers many, many command-line commands.

If you want to turn on the graphical login to a server, edit the /etc/inittab file, and set the runlevel to 5, if you want to turn off graphical login, set the runlevel to 3.

Changing the IP Address and Hostname

You can change the hostname and the ip address by modifying these 3 files:

/etc/sysconfig/network
/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/hosts
    

This command restarts the network services, which avoids you having to restart the server. Note that you should do this from a console, not a remote session as you'll loose network connectivity:

service network restart
    

As an aside, the command netconfig will perform the ip address changes, but not the hostname change.

Some useful Graphical Tools

If you want to run any graphical tools from your ssh session, remember to add & after the command, so that you don't lock your ssh session until you're done with the graphical tool (allows you to launch multiple windows from the same ssh session).

Adding Users and Groups : system-config-users

Editing a file : gedit

Instaling applications from the original CD's : system-config-packages

Installing applications from the Redhat repository : Actually, this tool is both graphical and non graphical. For updates, just type up2date (which is graphical). To install software that you know the name of, you'd type it like this example: up2date firefox (which just uses the command-line). To just download the software without installing it: up2date --download firefox

Managing Services : system-config-services, you can start apache here (called httpd).

View the log files : system-logviewer

Other commands : There are many, but take a look in this directory to start (you'll recognise some from above): /etc/security/console.apps

Browsing the File System : nautilus --no-desktop --browser

A "Task Manager" : gnome-system-monitor

A Cygwin X-Window Oddity

Sometimes, when trying to connect to a server, and send the display back to your Windows PC, you'll get the following error:

XWin: client # rejected from IP...

Typically, you'll start the x-windows server, then telnet or ssh to another server, and set the display by typing:

export DISPLAY=YourIPAddress:0.0

Here's how to fix the problem:

1. Open %cygwin_root%\usr\X11R6\bin\startxwin.bat (or %cygwin_root%\usr\X11R6\bin\startxwin.sh if you use that)

2. Add -ac to the end of the %RUN% XWin -multiwindow -clipboard -silent-dup-error line.

3. Restart Cygwin and your x-server, and try again.

Desperate Measures

Sometimes, you have to login as root and su to the correct user. Running xclock works as root, but you get the following error (or something like it) when you try to run it as the other user:

X11 connection rejected because of wrong authentication.
X connection to localhost:10.0 broken (explicit kill or server shutdown).
    

This is not an secure and advisable solution, but sometimes, you've got to get your job done quickly; locate the .Xauthority file for root (sometimes it's in the / directory), and run: chmod 777 .Xauthority

Then su to the other user, and xclock should work.

© Roqet :: 2022-03-01 16:07:34