Error 

Switching to zsh

330 views
Posted February 20, 2010 at 04:02pm in Linux with tags , , ,

I have never looked into using a different shell in Linux, I’m not entirely sure why, maybe I just liked bash enough. This past week I started looking into zsh, and liked what I saw. Last night I migrated my shell files to be 99.9% interchangeable between shells and continue to load what I want without me having to change anything.

This post outlines some changes I made that will allow me to use both bash and zsh with the same startup files, but still have some shell specific settings that will get sourced. I didn’t need to move the files to ~/.shellfiles, but I felt having all of them as symlinks instead of some being symlinks to other dotfiles. Some of the shell specific things are setopt/shopt commands, setting prompts, and history settings.

I am storing the files in ~/.shellfiles, it isn’t my preferred choice, but it is less likely to be used by something else. Since I use version control on my home directory I needed to first ‘hg rename’ each one of my files to the ~/.shellfiles directory. After moving the files symlinks needed to be created to the original files.

Continue reading

First PGP Key Signing Party

403 views
Posted January 25, 2010 at 02:01am in Security with tags , , ,

Friday was my first time attending a PGP key signing party. We had it in one of the buildings on campus and I thought I would share some of the commands I used to handle all the certificates. I created a method for handling key signing parties while I did this one, but I think this is a fairly good method. What it basically does is keeps specific users in your pubring.gpg, while people at keysigning parties are in specific keyrings. When defining them in your gpg.conf file they will be included in all of your GPG operations so it will be like they were in your pubring.gpg keyring. It also means that if you don’t associate with anyone in the keysigning parting you can just comment out the file and still have the keys for later use or for archival purposes.

I first wanted to have these be in a specific keyring for the purposes of knowing who was at each keysigning. To make sure your key gets added to the keyring you need to specify not to use the default keyring and use a specific keyring.. Make sure you include your keyid in the list of keys to pull from the keyserver as it will be needed when PIUS runs against the specific keyring.

Continue reading

Suggested change to aliasing commands

210 views
Posted January 18, 2010 at 02:01am in Linux with tags , ,

When I wrote the code to automatically generate aliases for hosts in my SSH config I started thinking about how checks are never done to verify we are not overriding an existing alias. This is my solution for it. I almost think that alias should be an alias for register_alias so that all aliases get checked, but I’m sure there could be an instance where it would break something. Let me know what you think about assigning aliases this way.

# .bash_functions
function register_alias() {
  local alias=$(echo $* | cut -d'=' -f 1)
  local TEMP_CMD=$(which $alias)
  local TEMP_ALIAS=$(echo "`alias`" | sed 's/alias\ \(.*\)=.*/\1/' | grep ^$alias$)
  if [ ${#TEMP_CMD} -gt 0 ]; then
    echo "Alias $alias conflicts with command $TEMP_CMD"
  elif [ ${#TEMP_ALIAS} -gt 0 ]; then
    echo "Alias $alias conflicts with alias $alias"
  else
    alias "$*"
  fi
}
# .bashrc
if [ -f ~/.bash_functions ]; then
  . ~/.bash_functions
fi
# .bash_aliases

register_alias sls='screen -ls'
register_alias sdr='screen -d -r'

Update: I changed the TEMP_ALIAS line to use sed instead of cut/sed