Archive

Posts Tagged ‘config’

SSH Magic

April 7th, 2010 No comments

A friend of mine just recently posted a trick with long hostnames when using SSH. I have commented before many times when I see people making aliases or shorthand’s like this that they just don’t know about the magic that is possible in the SSH configuration file.

Take for example this, imagine having a long hostname, with an odd port and a different user. Typing that would be a pain, most people would do something like:

alias ssh-short="ssh -p 12345 someotheruser@somelong.hostname.com"

In their ~/.bashrc, however the same can be filled into the configuration file. Edit the file ~/.ssh/config (or make it!):

Host short
  HostName somelong.hostname.com
  User someotheruser
  Port 12345

After doing this you can simply do:

$ ssh short

How much easier do you need it to be?!

Tags: , ,

WPA2 Wireless With Linux

February 18th, 2010 No comments

This is a simple tutorial produced by me and my good mate enigma. It is aimed at Gentoo and uses the Broadcom drivers but this should replicate to other systems.

The first step is to get your drivers and for Broadcom, which is relatively easy as they produce them for us. So first download the driver (these drivers support BM4311-, BCM4312-, BCM4321-, and BCM4322-based cards) and was also successful in this case with BCM4328.

Check that the package ‘linux-headers’ is installed, this is really just for completeness sakes. Gentoo would not work for long without this package!

(gentoo)# emerge linux-headers
... output ...

Unpack the downloaded drivers and build for your current kernel:

(gentoo)# tar -xzf hybrid-portsrc-ARCH-VERSION.tar.gz
(gentoo)# make -C /lib/modules/`uname -r`/build M=`pwd`
... output ...

Remove any existing wireless drivers.

(gentoo)# rmmod ndiswrapper b43 ssb bcm43xx b43legacy

Add in some modules required for WPA wireless:

(gentoo)# modprobe ieee80211_crypt_tkip

Test the newly built wireless driver:

(gentoo)# insmod wl.ko
(gentoo)# iwconfig
.. output ...
(gentoo)# iwlist scanning
... output ...

If that is working we can copy in the driver to the kernel and add to the autoload:

(gentoo)# cp wl.ko /lib/modules/`uname-r`/kernel/net/wireless/
(gentoo)# rmmod wl
(gentoo)# modprobe wl
(gentoo)# echo 'wl' >>/etc/modules.autoload.d/kernel-2.6

So now we have a working driver we can go on to configure for WPA. Alter the /etc/conf.d/net (note we assume that eth0 is wireless):

# Prefer wpa_supplicant over wireless-tools
modules=( "wpa_supplicant" )
 
# It's important that we tell wpa_supplicant which driver we should
# be using as it's not very good at guessing yet
wpa_supplicant_eth0="-Dmadwifi"

Next set up the network in the /etc/wpa_supplicant/wpa_supplicant.conf:

# This setting is required or the connection will not work
ctrl_interface=/var/run/wpa_supplicant
 
# Ensure that only root can read the WPA configuration
ctrl_interface_group=0
 
# Let wpa_supplicant take care of scanning and AP selection
ap_scan=1
 
# Only WPA-PSK is used. Any valid cipher combination is accepted
network={
  ssid="example"
  proto=WPA RSN   # RSN is needed for WPA2
  key_mgmt=WPA-PSK
  pairwise=CCMP TKIP
  group=CCMP TKIP WEP104 WEP40
  psk=06b4be19da289f475aa46a33cb793029d4ab3db7a23ee92382eb0106c72ac7bb
  #The higher the priority the faster it connects
  priority=2
}

And that is it, you should find that your wireless is enabled on boot.

Thanks should also go to DJ Kaos for the preparation of the driver.

Tags: ,

GPG Errors

August 11th, 2009 No comments

Sometimes when you are installing RPM’s or Deb’s you will find yourself faced with GPG errors. Instead of ignoring them why not fix them!

Simply download the key by using the GPG tool:

gpg --keyserver pgpkeys.mit.edu --recv-key E6F33B6628973CC0

Then import that key into either apt:

gpg -a --export 010908312D230C5F | sudo apt-key add -

Or rpm:

gpg --export -a 010908312D230C5F >key.txt
rpm --import key.txt

Simple!

Tags: ,

HTML E-mails And Mutt

June 27th, 2009 2 comments

I find myself regularly using terminals and thus have grown to love any tool that allows me to remain in terminal. Mutt is only of those, a fantastic terminal mail client. The only issue is that most people these days send HTML e-mails rather than plain text. This means that when I open them in mutt it is very unreadable. However there is a very simple solution.

First off lets make a simple script to convert the HTML into text. Several terminal based browsers exist and these can do the conversion for us (make sure to place it in your PATH somewhere).

#!/bin/sh

if [ ! -z `which links | grep -v 'no links'` ]
then
  links -html-numbered-links 1 -html-images 1 -dump "file://$@"
elif [ ! -z `which lynx | grep -v 'no lynx'` ]
then
  lynx -force_html -dump "$@"
elif [ ! -z `which w3m | grep -v 'no w3m'` ]
then
  w3m -T text/html -F -dump "$@"
else
  cat $@
fi

Add this to your ~/.muttrc:

auto_view text/html
alternative_order text/enriched text/plain text text/html

And then this to your ~/.mailcap:

text/html;html2txt %s; copiousoutput

Start up Mutt and get nothing but text e-mails.

Tags: ,

Click URLs In URxvt

October 15th, 2008 No comments

Most terminals these days have the ability to click on a URL and then it opens in your browser. Needless to say some terminals aren’t as simple to setup as others. I commonly use URxvt and initially didn’t think that it was possible to do. However URxvt has a rather nice Perl plug-in which expands its range of abilities. So to setup, edit or create ~/.Xdefaults and add these lines to it:

urxvt*urlLauncher:  firefox
urxvt*matcher.button:  1
urxvt*perl-ext-common:  default,matcher,searchable-scrollback
urxvt.matcher.pattern.1:  \\bwww\\.[\\w-]\\.[\\w./?&@#-]*[\\w/-]

Now you need to make this work:

# xrdb -merge ~/.Xdefaults

You may need to add this command to ~/.xinitrc or whatever startup script that your desktop uses. Most systems should automatically load it when your X starts.

Whilst I chose to use firefox as the browser you can set it to any other browser, indeed if you are using Gnome a trick to use the default browser is:

urxvt*urlLauncher:  gnome-open

This is actually rather handy because you can click on a variety of links not just web ones and it will open the correct tool for those links. Thanks to Nion’s blog I found out that you can colour the URLs too! Finally to those that wish to be mouseless, how about Bart’s blog for an awesome example of the abilities of URxvt!

Tags: , ,

Switch to our mobile site