Terminal Services shortcut

November 6th, 2007

As a network administrator, I use Microsoft Remote Desktop (Terminal Services) on a daily basis. In Windows XP, the Remote Desktop shortcut is buried deep within the Start Menu. Additionally, Microsoft recently updated their Remote Desktop client. As part of this change, they moved the shortcut.

Previously it was located here:
Start->All Programs->Accessories->Communications->Remote Desktop

Per the new version is it:
Start->All Programs->Accessories->Remote Desktop Connection

I find this way a lot easier:
Start->Run->mstsc

run.jpg

“mstsc” stands for Microsoft Terminal Services Client. Sure, you could create a desktop shortcut, but when working with multiple workstations that becomes a hassle.

store.exe

September 17th, 2007

I noticed my Exchange 2007 server was paging. Store.exe (the Exchange information store) was using over 1.5GB RAM.

The official exchange team blog says this is normal.

Exchange Store will grab as much RAM as it can if it thinks it needs it, yes. But - we constantly monitor the performance of the system in regards to memory usage and we can use this data to infer when we need more memory and when other applications or the OS needs more memory. We then use this data to act accordingly. This scheme allows the system to act as if there is explicit control when in fact it is actually a few autonomous applications cooperating in a disconnected manner. That means that we should NEVER see a “out of memory” message by any application on the server because of the Store - unless there is a leak on the server, of course… or the page file is too small. If there was a malfunction in this Store mechanism it would cause a lot of paging. That is a big performance problem, but shouldn’t cause actual errors.

I also run Flash Media Server on this machine (its a dual quad core). Video streaming seems sluggish. The event log show FMS complaining that it has no RAM. Thank you Microsoft! Below is my RAM usage:

RAM Usage

Unix Home Directories with winbind

September 11th, 2007

At work we have some Unix machines that authenticate with the Win2k3 domain. Problem is, when new users are created on the domain, Unix home directories are not created. You could set PAM to created the home directory upon first SSH login. However if the user logs in via SFTP or SMB the home directory would not be created. Below is a script I wrote (runs in cron) to create home directories for new users. Basically it checks the contents of “/home” against “wbinfo -u”.

#!/bin/sh
# Steve Horbachuk 2007
# Creates home directories for users that don't already have them

# Remove these:
# Administrator
# Guest
# krbtgt
# SUPPORT_388945a0
# IUSR_SERVER
# IWAM_SERVER
# stu
# fac

WBINFO=/usr/bin/wbinfo
SED=/bin/sed
LOG=/var/log/my-mkhomedir

# check if winbind is working
$WBINFO -u > /dev/null
if ! [ $? = "0" ]; then
echo "Get user list failed!"
echo "Is winbind running?"
exit 1
fi

LIST=`$WBINFO -u | $SED -e '/Administrator/d;/Guest/d;/krbtgt/d;/SUPPORT_388945a0/d;/IUSR_/d;/IWAM_/d;/fac/d;/stu/d'`

for USER in $LIST; do
if [ ! -d /home/${USER} ]; then
echo `date` Created ${USER} >> $LOG
mkdir /home/${USER}
cp -R /etc/skel/* /home/${USER}
chown -R ${USER} /home/${USER}
chgrp -R 'Domain Users' /home/${USER}
chmod 711 /home/${USER}
fi
done
exit 0

Kernel Packages

September 4th, 2007

I had to recompile my Debian Etch (4.0) kernel to include the Layer7 filter (and ipp2p) source patch as well as include Netfilter support.

Here are the prebuilt kernel packages:
http://stevehorbachuk.com/kernels

You can add then to a Debian system by doing this:

dpkg -i linux-image-2.6.22.5-custom2_2.6.22.5-custom2-10.00.Custom_i386.deb
dpkg -i linux-headers-2.6.22.5-custom2_2.6.22.5-custom2-10.00.Custom_i386.deb

This will automatically add this custom kernel to /boot/grub/menu.lst.

pcns221lnx.bin & Red Hat Enterprise Linux 4

September 3rd, 2007

pcns221lnx.bin is the APC Network Shutdown installer for Linux. It took me a while to figure out how to install this software on Red Hat Enterprise Linux 4, so I figured I’d drop a note here.

PCNS is poorly maintained and is a few years old now. Additionally Red Hat ships with GCJ java, which is shit. Upon execution it would throw cryptic error messages such as:

Preparing wizard…
Searching for JVM…
Starting the wizard…
Error: You need Swing 1.1 or 1.2 in your classpath to run this program.

And:

Preparing wizard…
Searching for JVM…
Starting the wizard…
See errors.log for other possible causes.out of disk space?

The biggest problem I had was that the installation documentation does not mention that the installer requires an X Server! Thanks a lot APC!

Here’s what I did to install it:

ssh steve@server

su
Change to root

rpm -e java-1.4.2-gcj-compat-1.4.2.0-27jpp
rpm -e java-1.4.2-gcj-compat-devel-1.4.2.0-27jpp
Remove old Java packages

rm -rf /usr/local/bin/jvm
Clean up if needed

mkdir /usr/java
Make new installation directory

cd /usr/java
Change to that directory

wget -O jre.bin http://javadl.sun.com/webapps/download/AutoDL?BundleId=11284
Download the JRE binary installer

chmod a+x jre.bin
Change permissions to allow execution

./jre.bin
Execute the JRE installer and follow the prompts

export PATH=$PATH:”/usr/java/jre1.6.0_02/bin”
Include the JRE binaries in the PATH where “jre1.6.0_02″ is the JRE version you installed

vi /root/.bash_profile
Change line that begins with “PATH” to this “PATH=$PATH:$HOME/bin:/usr/java/jre1.6.0_02/bin” where “jre1.6.0_02″ is the JRE version you installed

which java && java -version
Check if everything is working

up2date -i xorg-x11 xterm
Install X11 (if not already installed)

Launch a SSH session with X-Win32:

su
Change to root

cd /usr/local/src
Change to our source/installer directory

wget ftp://ftp.relline.ru/pub/unix/apc/pcns-221/pcns221lnx.bin
Download the PCNS binary installer

chmod a+x pcns221lnx.bin
Change permissions to allow execution

./pcns221lnx.bin
Execute the PCNS installer and follow the prompts

PowerChute Network Shutdown

ps -ef | grep “jre”
Make sure the PCNS process is running

EuroTrip

September 1st, 2007

Here is the EuroTrip sound clip of Mr. T saying “Mail, Motherfucker!” If you use Windows and Outlook or Outlook Express you can set it as your new mail notification in the Control Panel. Both are under 60KB in size.

Here are the sound files:
Mail, Motherfucker! | Mail, Motherfucker! (Loops twice)
Audio Info:
Bit Rate: 140kbps
Channels: 2 (stereo)
Sample Rate: 48 kHz
Format/compression: LAME MPEG Layer-III
Extension: .WAV (Microsoft)
Copyright: EuroTrip, DreamWorks Home Entertainment

Intel Create and Share

August 16th, 2007

I have an Intel PC Camera Pro and I had a hell of a time getting drivers and software that work with Windows XP. Intel tries to make you buy a CD, forget it. If you have an older Intel web cam and can’t find drivers, try these.

Download Intel Create and Share Software

Backup Script

August 15th, 2007

I recently created a BASH script that creates a g-zipped tarball and writes it to a NAS. It also checks the free space available on the NAS and deletes previous backups until it has enough space to store a new backup. Maybe someone will find it useful or will be inspired to improve it.

Variables to modify:

DATA = What directories you want to backup.
LOGDIR = Where you want the backup logs to be stored.
BACKUPMNT = The mount point of your NAS or backup device.
BACKUPDIR = The directory on the mount to store the backup.

#!/bin/bash
# Steve Horbachuk 2007
# tars directories and writes to NAS
#

DATA="/home /root /etc /usr/local /var/www /var/log"
LOGDIR="/var/log/my-backup"
BACKUPMNT="/mnt/linkstation"
BACKUPDIR="/mnt/linkstation/server"
MYDATE=`date +%F`
LASTFILESIZE=0
LASTFILENAME=""

echo "Backup started : `date`" > $LOGDIR/backup_$MYDATE.log
echo "-------------------------------------------------" >> $LOGDIR/backup_$MYDATE.log

#find the last file in the backup folder
#and store information about it.
for FILE in $BACKUPDIR/*; do
if [ -f $FILE ]; then
FILEINFO=(`ls -lk $FILE`)
LASTFILENAME=${FILEINFO[8]}
LASTFILESIZE=${FILEINFO[4]}
fi
done

#delete files until there is enough space to hold a file
#the same size as the last backup.
for FILE in $BACKUPDIR/*; do
DISKINFO=(`df -k | grep $BACKUPMNT`)
DISKFREE=${DISKINFO[3]}
if [ -f $FILE ]; then
if [[ "$LASTFILESIZE" -gt "$DISKFREE" ]]; then
rm -vf $FILE >> $LOGDIR/backup_$MYDATE.log
fi
fi
done

tar -czf $BACKUPDIR/backup_$MYDATE.tar.gz --exclude='*.iso' --exclude='*/tmp/*' $DATA >> $LOGDIR/backup_$MYDATE.log

echo "-------------------------------------------------" >> $LOGDIR/backup_$MYDATE.log
echo "Backup finished : `date`" >> $LOGDIR/backup_$MYDATE.log

Here is the mount in /etc/fstab:
//10.0.0.50/share /mnt/linkstation cifs rw,guest 0 0

Where “//10.0.0.50/share” is the SMB share on the NAS, and /mnt/linlkstation is the Linux mount point.

Flash Video

August 14th, 2007

A couple of semesters ago I created this movie for a design class. I guess it’s pretty funny.

Big Site Change!

August 13th, 2007

As you may have noticed there is a big change in the site. I seem to have installed Wordpress. Recently some things have happened that inspired me to get this log back up and running. For now, I’m enjoying the default theme, until I get a chance to play around with the CSS.

The old site has been archived. I will probably tidy it up and keep it on the server for history’s sake. I will repost anything useful from it.

There will also be a new direction towards the site. I will post movie reviews and various tech things.