Category Archives: Reference

Short references for personal… reference. Basically a howto for the tech-savvy.

Save and restore partition tables with sfdisk

In my raid setup, I set up the partitions a certain way for running several mdadm raids on the same drive. My server currently boots off of two drives, sda and sdb, where sda1 and sdb1 are the root file system in raid 1 (mirror) and sda2 and sdb2 are (encrypted) swap in raid 0 […]

sudo without a password

Note, this is not something I recommend doing. In fact, the only reason why I’m documenting it is that I am removing this solution from the last box I used to have it on. Anyway, edit the /etc/sudoers file (with visudo, as root), then add lines under the default one for root, like this: # […]

Using Flags and Arguments in Bash

Here’s a simple example script, showing how to deal with different inputs depending on the flag preceding them: #!/bin/bash USAGE=”Usage: Enter a noun after either -p (polite) or -i (insulting).” while getopts “:p:i:” OPTIONS; do case $OPTIONS in p ) polite=$OPTARG;; i ) insulting=$OPTARG;; h ) echo $USAGE;; \? ) echo $USAGE exit 1;; * […]

exim4 smarthost smtp password

Note to self: To use a smarthost you have to authenticate to with exim4, edit /etc/exim4/passwd.client # password file used when the local exim is authenticating to a remote # host as a client. # # see exim4_passwd_client(5) for more documentation # # Example: ### target.mail.server.example:login:password *:myusername:myawfullylongpassword Here I added a username and password for […]

Use OpenDNS with Smoothwall Express 3.x

If you’re using DHCP to get your public IP, Smoothwall doesn’t allow you to override the DNS addresses given by your ISP through the DHCP protocol. Time to override Smoothwall 🙂 Edit /etc/rc.d/rc.updatered, and add “DNSMASQ_DNS1=208.67.222.222” and “DNSMASQ_DNS2=208.67.220.220” at the bottom of the DHCP section, making the file look like this: #!/bin/sh . /var/smoothwall/ethernet/settings if […]

What’s touching that config file?!

Recently I started wondering what the heck was putting “root: bolt” at the end of /etc/aliases “every time” I did an upgrade of something. I asked #debian on irc.freenode.net, who told me to run this: grep /etc/aliases /var/lib/dpkg/info/*postinst What it does is basically to look though all files which names end in “postinst” in the […]

Switching alsa sound cards around

Short reference on switching around alsa sound cards, making another one the default. Needed to do this since my computer has 3 sound cards (M-Audio, SoundBlaster and the G35 headset) List alsa modules: cat /proc/asound/modules 0 snd_ice1724 1 snd_ctxfi 2 snd_usb_audio Edit /etc/modprobe.d/alsa-base.conf, adding the following lines (note the underscores from above are now dashes): […]

Windows 7 autologin

Short and simple: to allow automatically logging in on Windows 7, you need to press Win+R to open the run menu, then type “control userpasswords2” without the quotes and run it.

XFCE: Unable to perform shutdown

To fix this issue, add the following lines between <config …..> and </config> in /etc/PolicyKit/PolicyKit.conf <match action=”org.freedesktop.hal.storage.mount-removable”> <return result=”yes”/> </match> <match action=”org.freedesktop.hal.power-management.shutdown”> <return result=”yes”/> </match> <match action=”org.freedesktop.hal.power-management.reboot”> <return result=”yes”/> </match>