Archive for January, 2008

New people to meet

Tuesday, January 29th, 2008

A couple of weeks ago I went and took a test for Mensa membership. It was mostly a whim inspired by someone at work that is a member and a discussion with some co-workers.

I have not failed a test in about 15 years, when I first sat for the Amateur Radio technician level test. Working with computers and IT, certification tests are common and even the Red Hat Certified Engineer exam was challenging but I completed it and knew that I had done well. When I left from the Mensa exam, I had not completed anything and had no gauge of how well I did.

I received an offer to join Mensa last Friday, so it looks like I did well enough. There are a number of Special Interest Groups including Amateur Radio and Photography and I was surprised to find no Linux or Open Source Software SIGs. I’m just a regular guy whose would like to meet folks and have interesting conversations. The local members I have met are not pretentious at all and have been altogether enjoyable to visit with.

Get your Amateur Radio License with this free audio podcast

Sunday, January 27th, 2008

There are great audio podcasts that instruct the Technician and General material, and coming this summer, Extra! I already have tech level and the general is about 6 hours of audio. Don’t have a license? Start with tech class. They have CDs available in addition to the free MP3s

http://www.hamradioclass.org/

Securing the irked shell

Wednesday, January 23rd, 2008

I setup some user permission controls on irked…

First, I created a separate home and tmp so I could setup quotas:

lvcreate -L1G -n irked-home VolGroup00
lvcreate -L512M -n irked-tmp VolGroup00
mkfs -t ext3 /dev/VolGroup00/irked-home
mkfs -t ext3 /dev/VolGroup00/irked-tmp

Updated the irked config:

, 'phy:VolGroup00/irked-home,sda5,w'
, 'phy:VolGroup00/irked-tmp,sda6,w'

I used the flip script to rotate the filesystem to the new partitions.

Added the new filesystems to /etc/fstab

/dev/sda5       /home   ext3    usrquota                0       0
/dev/sda6       /tmp    ext3    usrquota                0       0

Remounted to get the usrquota option

mount -o remount /home
mount -o remount /tmp

Touched the quota files and installed the quota packages

touch /home/aquota.user
touch /tmp/aquota.user
apt-get install quota quotatool
# edquota charles
Filesystem                   blocks       soft       hard     inodes     soft     hard
/dev/sda5                       160      40000      50000         10        0        0
/dev/sda6                         0      20000      25000          0        0        0
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
charles   2031  0.0  2.5   7712  1688 ?        S    13:47   0:00 sshd: charles@pts/2,pts/3
charles   2032  0.0  2.6   3216  1760 pts/2    Ss   13:47   0:00 -sh
charles   2033  0.0  2.6   3212  1752 pts/3    Ss+  13:48   0:00 -sh
charles   2054  0.0  1.8   2288  1224 pts/2    S+   13:49   0:00 nano test

That is an RSS of 6424. RSS is resident memory or something close to that.

Added users to the users group so the limits.conf will apply. The group restrictions in /etc/security/limits.conf apply if you are a member of a group even if it is not your primary group.

@users          soft    maxlogins       1
@users          hard    maxlogins       2
@users          soft    nproc           3
@users          hard    nproc           4
@users          soft    rss             8000
@users          hard    rss             10000
apt-get install libpam-umask

# nano /etc/pam.d/common-session
session optional pam_umask.so umask=077
session required        pam_unix.so

Setting libpam-umask did not work so I changed /etc/skel/.bash_profile, root and my user to umask=077 just for good measure.

CUPS going offline when it runs out of paper

Wednesday, January 16th, 2008

In several distros the default behavior when a printer is not available is to shutdown the printer queue for that printer. You can turn it back on with:

# cupsenable <printername>

But a better fix, especially if you have many printers is to change the default behavior by editing /etc/cups/printers.conf. Find the string ErrorPolicy and change the line:

ErrorPolicy stop-printer

To read:

ErrorPolicy retry-job

If the printer has a problem it will not print of course, but if it is only paper it will continue later.

Fixing the <code> width with <pre>

Thursday, January 10th, 2008

I wanted a way to set apart code, and that was easy enough to find. I had to add a scrollbar to prevent display weirdness, like text leaving the box. I open a <pre> tag, then a <code> tag and put the contents in, then close the tags </code></pre>. I changed the style.css to outline and provide an outline. The background color didn’t work in Firefox but I haven’t tested it in IE yet.

pre {
	border: solid 1px blue;
	font-size: 1.3 em;
 	color: blue;
	margin: 10px;
	padding:10px;
	background-color: #FFFFB3
	width: 100%;
	overflow: auto;
	/*overflow:-moz-scrollbars-horizontal;
	overflow-x:scroll;*/
	}
code {
	font: 1.1em 'Courier New', Courier, Fixed;
	color: #008899
	}

Welcome to a new day at Revantine.net

Tuesday, January 8th, 2008

The notes here will primarily be technology projects I am working on or occasionally a photography outing. If the information is on Google on the first page, I probably won’t have it here. If the information took half a dozen sites and a weekend to implement, I will memorialize it here so we can both find it.

You can view some of my photography at www.capturinglife.org.

Movin’ on up

Tuesday, January 8th, 2008

I’m moving from TiddlyWiki to WordPress. This will provide a nicer online experience at the expense of offline viewing.

Until I get the articles moved you can find previous posts at http://www.revantine.net/revantine.net_TiddlyWiki.html

Basic screen commands

Thursday, January 3rd, 2008

I will fix this migrated post at a later time.

The screen command lets you have multiple panes and screen workspaces with multiple shells. You can also detach screen so that it will continue in the background or you can move to a different machine and reattach. Once you have loaded screen by typing screen at the command line, you can issue commands with Ctrl+a then a key. Common keys are listed below.

To detach screen from the current shell, use Ctrl+a d
To reattach to the screen, run screen -r

Ctrl+A to start command mode

Shift+S    split screen
n    next window
Tab    next pane
backspace, h, p    previous window
c    create shell
Ctrl+\    Kill all windows and terminate screen (quit)
[,Esc    Enter copy/scrollback mode

My .screenrc

Thursday, January 3rd, 2008

My new ~/.screenrc

hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c:%s %{g}]'

screen -t shell1        0
screen -t shell2        1
#screen -t shell3       2
#screen -t shell4       3       ssh hostname.domain.com

irked vm

Thursday, January 3rd, 2008

I setup a VM for psybnc and irssi.

# cd /xen
# mkdir irc
# cd irc
# tar xjvf ../debian-4.0-20070809.tar.bz2

Generate the last 3 bytes for the MAC

dd if=/dev/urandom bs=1 count=3 2>/dev/null | od -tx1 | head -1 | cut -d' ' -f2- | tr -d ' ' | tr '[a-f]' '[A-F]'

Create the config file /xen/irc/irc.cfg

kernel = "/boot/vmlinuz-2.6-xenU"
memory = 64
name = "tigger"
vif = [ 'bridge=xenbr0,mac=00:16:3e:97:29:51' ]
dhcp = "dhcp"
disk = ['file:/xen/irc/debian-4.0.img,sda1,w'
, 'file:/xen/irc/debian.swap,sda2,w'
]
root = "/dev/sda1 ro"
ramdisk = "/boot/initrd-2.6-xenU.img"

I linked the config so it will autostart when owl boots and I started the vm

ln -s /xen/irc/irc.cfg /etc/xen/auto/
xm create -c irc.cfg

Watch the boot, and ssh to the dhcp temp address

/etc/network/interfaces

auto eth0
iface eth0 inet static
        address x.y.z.202
        netmask 255.255.255.224
        gateway x.y.z.222

/etc/resolve.conf

search revantine.net
nameserver 192.168.0.36

reset the root password
change the ssh port
Set the hostname in /etc/hostname

irked.revantine.com

If you get “4gb seg fixup” errors, this will probably fix it.

apt-get update
apt-get install libc6-xen
echo "hwcap 0 nosegneg" > /etc/ld.so.conf.d/nosegneg.conf
ldconfig -v -p 2>&1 | grep libc.so
ldconfig

Permissions on /tmp are correct.
Maybe the permissions are only messed up if you have a seperate /tmp partition.

useradd charles
useradd psybnc

existing psybnc.sh to start psybnc:

#!/bin/bash
MATCHTEXT=[p]sybnc$

if ! ps -A|grep -e $MATCHTEXT >/dev/null
then
  date
  echo "Script starting..."
  exec su psybnc -c "cd /usr/local && ./psybnc"
else
#  echo "Script is already running."
  exit 1
fi

I add this to /etc/rc.local to start psybnc:
su phybnc -c “cd /usr/local && ./psybnc” &>/dev/null &

My new ~/.screenrc

hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c:%s %{g}]'

screen -t shell1        0
screen -t shell2        1
#screen -t shell3       2
#screen -t shell4       3       ssh hostname.domain.com