« May 2005 | Main | September 2005 »

July 27, 2005

Concurrent GUI Logins

Ever wanted to do multiple concurrent GUI logins ala "fast user switching" in Windows XP? It's really not that hard.

These instructions assume you are using GDM as your display manager. The file paths are written assuming that you are using a RedHat based distro.

The first step is to make sure you are using the GDM display manager. Edit the file /etc/sysconfig/desktop and make sure the DISPLAYMANAGER= looks like this:

DISPLAYMANAGER=GDM

The other lines can be left with their default settings.

Now to move on to configuring GDM to start mutiple X servers both offering a login screen, one bound to tty7 and the other bound to tty8. The remaining edits should all take place in the file /etc/X11/gdm/gdm.conf and can be made all at once.

We must change the default greeter from the pretty-looking graphical greeter to the more utilitarian standard greeter. I've found this offers better stability as the graphical greeter was prone to dying if called more than once. Locate the following lines towards the beginning of the file:

# Greeter for local (non-xdmcp) logins. Change gdmgreeter to gdmlogin to
# get the standard greeter.
Greeter=/usr/bin/gdmgreeter

Change the Greeter= line so that it looks like this:
# Greeter for local (non-xdmcp) logins. Change gdmgreeter to gdmlogin to
# get the standard greeter.
Greeter=/usr/bin/gdmlogin

To avoid the haphazard placement of our X servers we enforce them to start allocating terminals at tty7. Locate the lines:

# Automatic VT allocation. Right now only works on Linux. This way
# we force X to use specific vts. turn VTAllocation to false if this
# is causing problems.
#FirstVT=7
#VTAllocation=true

Un-comment the two setting lines like so:
# Automatic VT allocation. Right now only works on Linux. This way
# we force X to use specific vts. turn VTAllocation to false if this
# is causing problems.
FirstVT=7
VTAllocation=true

Configure an additional server that will always be started. The number at the first of the line is used as the display number when calling the corresponding X commmand. In the section shown here:

[servers]
# These are the standard servers. You can add as many you want here
# and they will always be started. Each line must start with a unique
# number and that will be the display number of that server. Usually just
# the 0 server is used.
0=Standard

Add another server line with the server number incremented. You can add as many as you like. The entry should look like this:
[servers]
# These are the standard servers. You can add as many you want here
# and they will always be started. Each line must start with a unique
# number and that will be the display number of that server. Usually just
# the 0 server is used.
0=Standard
1=Standard

Save and exit the gdm.conf file you've been editing. Reboot, or switch to runlevel 3 and back to 5, or send GDM a HUP signal. This will reload GDM and make it read the newly modified file.

Now for the magic part... When your displays come back up you will have a graphical login avalible on tty7 and tty8. Switch between them by using the keystroke CTRL-ALT-F7 and CTRL-ALT-F8.

There ya have it. A cheap-O way to multiple GUI logins. Instructions on configuring KDM and XDM are in the works so watch this space for more.

Posted by dcarter at 03:38 PM | TrackBack

July 14, 2005

Multi-Line sed

Lets say you want to add "disable = yes" after specific two lines in a file.

For example, the two lines:

service finger
{

The "N" command to sed tells it to read another line into the "input buffer" you can stack multiple "N"s if you need more than 2 lines.

So, the answer is:

sed -i -e N -e "s/service finger\n{/service finger\n{\n\tdisable = yes/g" /path/to/file-to-be-edited

To read 3 lines you would do something like:

sed -i -e N -e N -e N -e "s/changethis/tothis/g" /path/to/file-to-be-edited

Posted by dcarter at 11:38 AM | TrackBack