Linux Configuration In Office EnvironmentJuly 2, 2006
This is the collection of Linux-related tips and tricks, mostly administration and configuration that helps to integrate Linux system into Windows office environment.
- To check Hard Drive speed
- Command execution at graphical startup
- Init boot level
- Setting up remote logins
- Hostname resolution with WINS
- Printing to Windows Print Queue
- Mounting Windows shares
- Setting up time feed
- Setting up FTP daemon
- Configure rlogin to allow passwordless logins
- Booting into damaged root filesystem with installation disk
- Mounting /proc failed (dup2 error)
- Setting up Micro$haft wheel mouse
- Getting RedHat ISO files
- Making and using ext2 floppy
- No “core” file
- Apache web server
- Gnome2 custom menus
- Linux NFS-HOWTO
- Switching between Window Managers
- Make bigger fonts in Evolution
# /sbin/hdparm -Tt /dev/hdx /dev/hdy
where ‘x’ and ‘y’ (etc.) are the drive letters you wish to test. It will give you a transfer rate readout.
From the mailing list:
I had a little trouble with this myself. I tracked down the (problem??) to /etc/X11/xdm/Xsession. ~/.xsession is supposed to be executed upon startup of X from xdm (or kdm), but it is not unless to choose default. The default option falls through the case statement and then executes ~/.xsession. So just copy /etc/X11/xdm/Xsession to ~/.xsession and edit as necessary, then choose default from the KDM login screen or edit ~/.wmrc and replace text with default. Here is a copy of mine:
# $XConsortium: xinitrc.cpp,v 1.4 91/08/22 11:41:34 rws Exp $
# merge in defaults and keymaps
if [ -f $sysresources ]; then
xrdb -merge $sysresources
if [ -f $sysmodmap ]; then
# User defined key mapping
xmodmap -e "keycode 22 = BackSpace"
# GOLD key
xmodmap -e "keycode 77 = KP_F1"
if [ -f $userresources ]; then
xrdb -merge $userresources
if [ -f $usermodmap ]; then
# Let everybody have access
# start some nice programs
Default runlevel is set in /etc/inittab
# default runlevel
Meaning of the numbers:
- 0 –> system halt
- 1 –> single user mode
- 2 –> multiuser, without NFS
- 3 –> full multiuser mode
- 4 –> unused
- 5 –> X11
- 6 –> reboot
Run GNOME Menu Editor and for each category (epoch3 | skynet | other) add an entry to the App in the GNOME Foot:
rxvt -tn xterm -cr red -fn 10x20 -sr -sl 200 -title "epoch3@tpepc20" -e rlogin -l epoch3 tpepc20
Where options are:
- -tn xterm – set TERM variable to xterm
- -cr red – set cursor color “red”
- -sr – set scrollbar to the right side of the terminal
- -sl 200 – set scrollbar history to 200 lines
In /etc/samba/smb.conf file, set:
name resolve order = wins lmhosts bcast host
wins server = 172.16.1.1
wins proxy = yes
Start your Linuxconf and set your eth0 to use DHCP service. Also make sure samba services are started by bootup procedure. Restart you machine and you should be getting dynamically assigned IP address and your hostname should be resolved by DNS/WINS correctly.
1. First, SAMBA should be properly configured. In /etc/samba/smb.conf file, set:
workgroup = INTEGRAL
netbios name = vgrinche-nt
server string = Samba Server
security = user
password server = *
log level = 1
os level = 1
dns proxy = No
encrypt passwords = yes
smb passwd file = /etc/samba/smbpasswd
username map = /etc/samba/smbusers
comment = Home Directories
browseable = no
writable = yes
read only = no
comment = All Printers
security = Server
path = /var/spool/samba
browseable = No
guest ok = no
printable = Yes
public = Yes
create mode = 0700
2. Create a user named vgrinche with linuxconf tool.
3. Create SAMBA password file:
# smbpasswd -a vgrinche
4. Install enscript from RH CD-ROM.
5. Login as root (# su - )
6. Run RH printtool utility and set:
- Queue Name: lp
- Queue Type: Windows Printer SMB
- Share: //EUCLID/HP8150upstrs
- User: vgrinche
- Workgroup: INTEGRAL
- Printer Driver: HP LaserJet 8150 (postscript driver)
- Save and restart daemon
7. Create mount points:
# mkdir /mnt/pascal
# mkdir /mnt/pascal/Epoch
# mkdir /mnt/pascal/V2V3
8. Add mount points to /etc/fstab
//pascal/Epoch/ /mnt/pascal/Epoch smbfs username=vgrinche,noauto,ro,user 0 0
//pascal/V2V3/ /mnt/pascal/V2V3 smbfs username=vgrinche,noauto,ro,user 0 0
Optionally, you can specify password after username as password=PASSWORD
If you don’t know the printer’s name, or it has been changed, you can always find it out with LinNeighborhood. Browse EUCLID share – all the printers are listed there.
The two commands mount -t smbfs and smbmount are essentially equivalent with slight but subtle differences. If you use one command to mount a share, you have to use the same command to unmount the share.
Their syntax is almost identical:
smbmount //server/share /mountpoint [-o options]
mount -t smbfs //server/share /mountpoint [-o options]
If you use smbmount, the user who issues the smbmount command must own the mount point. This is true even if you create an /etc/fstab entry to allow users to mount shares. smbmount works better if you want allow individual users to mount remote shares.
- username=name This option specifies the username to be used on the server. smbmount sends this name to the Windows server in order to gain access to files. If UNIX username is different from the Windows username, this is the option to use. You can specify user name, password, and Windows workgroup: -o username=VGRINCHE/INTEG%MYSECRET
- password=passwd If you don’t include this option with smbmount, the program prompts you for the password.
- netbiosname=name This option sets the name by which the client goes when it connects to the server. It defaults to your system’s host name.
- uid=id This option sets the apparent owner of the files on the local mounted filesystem. It can be either user name or a number.
- gid=id This option sets the apparent group ownership of the mounted files.
- fmask=mask This option sets the permissions used for remote files on the share once it is mounted. Typically, it is fmask=640.
- dmask=mask Same as above, but for directories.
By default, many Samba installations give the smbmnt program (helper program for smbmount) superuser privileges for execution only. If ordinary user must be able to use these programs, it must be set user ID (suid) root:
$ chmod a+s /usr/bin/smbmnt /usr/bin/smbumount
smbmount //HILBERT/goes /export/home/vlad/Documents/GOES_RPM \
Time feed is taken from outside (internet) sources.
- Download xntp3.*.rpm package
- Edit /etc/ntp.conf configuration file, and add following lines to it:
server tick.usno.navy.mil prefer
server tock.usno.navy.mil prefer
server time.nist.gov prefer
- Restart xntpd server.
Time will slowly drift and synchronize with the outside servers.
By default, wu-ftpd package is not installed. Also, make sure that ksh is listed in /etc/shells file.
To allow logins from one account (vlad) to another (epoch3) on the same machine, change your ~/.rhosts file to look like:
Change permissions of ~/.rhosts to 0400.
By default, ~/.rhosts file is ignored. To enable it, change PAM policy by commenting out line below in the file /etc/pam.d/rlogin
# auth required /lib/security/pam_securetty.so
Now, try % rlogin vgrinche-nt -l epoch3 and it should not ask for password.
If LILO‘s MBR record or any part of your /boot directory is damaged and you can not login into your system anymore, last thing to try is booting with distirbution disk and telling it to mount your root partition as root (/). Pop in your RH cd-rom and type in at Linux: prompt
linux single root=/dev/hda1 initrd=
To repair the installation, boot CD with
If the boot message scrolled too fast off the screen, and you haven’t had a chance to see the error report, use Shift-Up/Down to scroll up/down the screen.
This is the way to remount various filesystems if you find yourself in “repair” mode and want to change some files:
mount proc /proc -t proc
mount /dev/hda2 / -o remounte,rw
mount /dev/hda1 /boot
Once in a blue moon I get this error message. Some people reported it happening after an upgrade.
Mounting proc filesystem dup2: Bad file descriptor
No such partition found ...
Somehow the effect of the update modifed /dev/null to be a regular file with some sort of message in it … hence “Bad file descriptor“. To fix, login into repair mode, remount root filesystem as read-write, and restore /dev/null:
# mount -n -o remount,rw /
# rm -f /dev/null
# mknod -m 0666 /dev/null c 1 3
Downloads are slow and I might do them in pieces. Therefore, I use wget from GNU. Here is the rough script that does the job. I admit it is not perfect, but is sufficient for now:
wget --glob=on --tries=0 \
wget --glob=on --tries=0 \
First, you format ext2 floppy with:
# /sbin/fdformat /dev/fd0H1440
# /sbin/mkfs -t ext2 -m 0 /dev/fd0H1440 1440
Then, modify you /etc/fstab floppy entry. This would allow anyone to mount and modify floppy disk.
/dev/fd0 /mnt/floppy auto noauto,users,nosuid,nodev,rw,sync,noexec 0 0
And finally, mount your floppy as user, and then change /mnt/floppy permissions to 0777. Otherwise, /sbin/mount would set directory’s permissions to 0755 even if nosuid is specified! /sbin/mount is setuid binary.
# chmod 0777 /mnt/floppy
The ulimit controls the size limit of serveral things in your Linux system, among them, the size of the core file. Issuing a ulimit -c 0 will tell Linux to disable core files. It is set in /etc/profile.
Another possible place for that limit being reinforced is in file /etc/security/limits.com It is a part of PAM system. The “soft” and “hard” refers to the kind of limits imposed.
Edit the Apache configuration file, /etc/httpd/conf/httpd.conf and add following lines:
# To enable requests to /~user/ to serve the user's public_html
# directory, use this directive instead of "UserDir disable":
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes IncludesNoExec FollowSymLinks
<Limit GET POST OPTIONS PROPFIND>
Allow from all
<Limit PUT DELETE PATCH PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>
Deny from all
Deny from all
Then, restart you web server.
To create a custom menu, first add a directory entry, Logins.directory to ~/.gnome2/vfolders directory. The file should look something like this:
Each item in the Logins menu is described by .desktop file. For example, a remote login to rpm@rpmdev1 account is described by ~/.gnome2/vfolders/Logins/rpm_rpmdev1.desktop, which looks like this:
Exec=rxvt -ls -bg black -fg white -tn xterm -cr red -fn 10x20 -sr -sl 200 -title
"rpm@rpmdev1" -e rlogin -l rpm rpmdev1
Notice the Categories entry. It is set to Logins;Utility. There is a dependency between that and the fact that there is Logins.directory file. This dependency is established by ~/.gnome2/vfolders/applications.vfolder-info file which is a modified copy of the system-wide file by the same name. The modifications add describe a new menu entry, Logins, and add a directory where *.desktop files for that entry can be found, ~/.gnome2/vfolders/Logins.
Here are the relevent modifications:
<!-- Logins -->
To switch between WMs, bring up Desktop Preferences->Advanced->Sessions window, find your running WM and change its status from respawn to normal. Then kill it, start another WM and save the session:
killall sawfish && sleep 5 && metacity && gnome-session-save &&
To change the font size used in menus and other app text for non-Gnome apps, edit /etc/X11/fs/config:
// file: /etc/X11/fs/config
// 1. Swhitch order of these 2 lines:
// 2. Change the line:
default-resolutions = 75,75,100,100
default-resolutions = 100,100,75,75