next up previous contents
Next: About this document ... Up: Redhat FAQ Previous: 20 KRUD Updates   Contents

Subsections

21 Miscellaneous Services

21.1 Setting up a Printer

Rev:
08/08/02
  1. Use the text printconf program
    # printconf-tui

21.2 Setting the default path

Rev:
4/24/01
To keep things simple use the same path for all users.

  1. Create a file called /etc/path with the following line:
    PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/X11R6/bin
  2. Comment out the PATH= line in /etc/profile and source the new path:
    . /etc/path 
    export PATH
  3. If desired, add the user's home bin directory in their personl .bash_profile:
    PATH=$PATH:$HOME/bin

21.3 Changing the colors ls uses

Rev:
12/12/02
The default colors are pretty awful. Expecially if you use white letters on a black background as the default for a tty screen. To change the colors on a per user basis:

  1. Change to your home directory
    $ cd
  2. Run dircolors to generate a data file
    $ dircolors -print-database >.dircolors
  3. Edit this newly created file to change colors. For example, to change the color for directories from the default blue to an easier to see yellow, change the line:
    DIR 01;34
    to:
    DIR 01;33
  4. Add to .bash_profile the line:
    eval `dircolors .dircolors`
  5. The above can be done globally by making changes in /etc/profile.

21.4 Adding/Removing words from cracklib_dict

Sometimes because users are unable or simply unwilling to create good passwords it becomes necessary to remove words from the cracklib dictionary. Use the unpacker and packer utilites that are included withteh source distribution of cracklib to do this.

  1. Unpack the current dictionary
    $ unpacker /usr/lib/cracklib_dict >words
  2. Use a text editor to remove the desired text
  3. Repack the dictionary
    $ sudo packer /usr/lib/cracklib_dict <words
  4. Copy to other machiunes as appropiate.

21.5 Booting Single-User Mode with Grub

  1. If you have a GRUB password configured, type p and enter the password.
  2. Select Linux with the version of the kernel that you wish to boot and type e for edit. You will be presented with a list of items in the configuration file for the title you just selected.
  3. Select the line that starts with kernel and type e to edit the line.
  4. Go to the end of the line and type single as a separate word (press the [Spacebar] and then type single). Press [Enter] to exit edit mode.
  5. Back at the GRUB screen, type b to boot into single user mode.

21.6 Converting an ext2 partition to ext3

Rev:
03/11/02
  1. Unmount the partition
    # umount /mp001
  2. Use tune2fs to create a journal on the partition
    # tune2fs -j /dev/md0
  3. Mount the filesystem as ext3
    mount -t ext3 /dev/md0 /mp001
  4. edit /etc/fstab to reflect the new filesystem type
  5. If possible, reboot to check that everything comes up correctly.

21.7 Create a Boot Floppy

Rev:
08/02/02
A boot floppy is often necessary to recover from a problem. Every server should have one that is up to date.

  1. Put a formatted floppy in the drive
  2. Use mkbootdisk to create a boot disk 
    # mkbootdisk <kernel-version>

21.8 Grabbing BIOS information (Dell Specific)

  1. Install the kernel-utils package if necessary.
  2. Use dmidecode
    $ sudo dmidecode
  3. This produces a lot of output which can be parsed for various values.

21.9 Redirecting the Console to a Serial Port

Rev:
08/02/02
Redirect console to /dev/ttyS1 (COM2) for boot and normal operation

  1. Make sure that the kernel supports a serial console. This is the default but may have been removed. In menuconfig:
    Character Devices -> Standard/generic seriial port -> Support for console on serial port.
  2. Install mgetty if necessary. It is not installed by default under Redhat.
  3. In the globabl section of /etc/lilo.conf

    1. Add:
      serial=1,9600n8 
      append=''console=ttyS1,9600''
    2. Delete or comment out:
      message=/boot/message
  4. Run lilo to install the changes
  5. Add to /etc/inittab:
    s1:12345:respawn:/sbin/mgetty -r -s 9600 ttyS1
  6. Reboot.

21.10 Adding Truetype Fonts to X-Windows

Rev:
04/03/2001
This is only necesary if you intend to use X-Windowing. The following assumes that xfs has already been set up which has been is standard on Redhat systems since at least 6.2. All of the below must be done with root privileges.

  1. Create a directory for the fonts  
    # mkdir /usr/share/fonts/ttf
  2. Change to the newly created directory  
    #cd /usr/share/fonts/ttf
  3. Extract the truetype fonts to the newly created directory  
    # tar -xvzf /<path to file>/truetype.tar.gz
  4. Create the fonts.scale file  
    # ttmkfdir -o fonts.scale
  5. Create the fonts.dir file  
    # mkfontdir
  6. Add the new fonts to xfs  
    # chkfontpath -add /usr/share/fonts/ttf
  7. Restart the X Fonts Server  
    # service xfs restart
  8. Exit and restart the X-server

21.11 Samba

Rev:
12/12/01

21.11.1 Add a machine to the Domain

$ sudo net join member -U <username>

These instruction are specific for the server Thames but can be adapted to any samba server

21.11.2 Adding a new User

  1. Log in onto thames
  2. Change to the directory /samba
    $ cd /samba
  3. Edit the file win-accounts
    $ vi win-accounts

    Each line describes the account in the format:

    <Username>:UserID>:<GroupID>:<First Name>:<Last Name>:<Additional Groups>

    The lines are sorted by user id so when adding a user, append a line at the end of the file using the next available userid. For example, add a user named ``Jim Jones'' who belongs to the marketing and administratin groups. If the next avaialble User is 3560, the entry will look something like:

    jjones:3560:100:Jim:Jones:marketing,administration

  4. Once the entry is added, run the program ``makentaccounts'' (See: 21.11.4) passing the data file name as an argument. This program reads the file and adds any users that do not already exist. This must be done as root
    $ sudo ./makentaccounts win-accounts

21.11.3 Editing existing Users

Right now, changes to user must be done by hand. Generally, only /etc/group has to be changed when a user moves. If a user is deleted, run ``userdel'' and delete reference to the user in /etc/group. The user's original home directory should be deleted, archived or have the ownership changed.


21.11.4 makentaccounts


#!/usr/bin/perl -w

# make user accounts for samba shares
# usage makentaccounts <data file> <target>
# read <path> from <data file>
# read usernames from <data file>
# if account does not already exist:
#    set directory to <path>/username
#    set ownership of directory to <username>:<group>
#    set shell to bin/false
#    make sure directory exists and has an all lowercase name
#
# data file format
# ignore comments (#) and blank lines
# PATH=<path>  path to apply to subsequent names
# username:uid:gid:first:last:extra groups

use strict;

my $PASSWD = "/etc/passwd";

my (@passwd);
my ($file,$target,$path,$line);
my ($user,$uid,$gid,$first,$last,$grps);

# get the list of existing users
open FILE,$PASSWD or die "Unable to read $PASSWD\n";
foreach $line (<FILE>) {
  ($user,$grps) = split /:/,$line;
  push @passwd,$user;
}

# open the data file
$file = $ARGV[0];
open FILE, $file or die "Unable to open $file for read.";

foreach $line (<FILE>) {
  # clear leading and trailing whitespace and CR
  $line =~ s/^\s+//;
  $line =~ s/\s+$//;
  $line =~ s/\n//;

  # if a comment
  if ($line =~ m/^\#/) { next; }
  if ($line eq "") { next; }

  # if PATH=
  if ($line =~ m/PATH=(.+)/) {
#    print "$line\n";
    $path = $1;
#    print "$1\n";
    next;
  }

  # extract the fields
  ($user,$uid,$gid,$first,$last,$grps) = split /:/, $line;

  # if the user already exists skip to next
  if (grep /$user/,@passwd) {
#    print "$user already exists\n";
    next;
  }
  # create the user using -m to cause directory creation
  system ("useradd -u $uid -g $gid -d $path/$user -c \"$first $last\" -s /bin/nologin -m $user\n");

  # if there are supplementary groups defined, add them
  if(defined $grps) {
    system ("usermod -G $grps $user");
  }
  # set wnership on all files in the new directory 
  system ("chown -R $uid:$gid $path/$user\n");
}

close FILE;

next up previous contents
Next: About this document ... Up: Redhat FAQ Previous: 20 KRUD Updates   Contents
2005-03-20