Author Archives: bolt

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 […]

OTP (one-time passwords) on Debian Squeeze SSH logins

So, you’re out of your secret lair and now you need to log in from a computer you don’t trust. After all, every computer you don’t administer is most likely full of viruses, malware and probably even a hardware keylogger somewhere along the keyboard cord, right? So you want to use a one-time password, so […]

Putty keeps disconnecting

On a recent vacation, taking a train across the entire country, I was using my cell phone’s 3G connection to provide my Internet connection. Every little tunnel and other signal interference along the way would cut off the SSH connection I was sending all my traffic through. While googling, still on the train, I found […]

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): […]