Debian WiFi Setup

Manual HowTo

I previously posted on setting up Debian laptop WiFi, that was running Gnome desktop, which has a lot of in-built tools to assist in such matters. If you run a different desktop such as XFCE4, the process may not follow the steps outlined in the earlier post. You'll have to do a manual install and setup.

Its not hard, just takes a little work.

Set up WiFi with WPA2, more secure than WPA1 or the almost transparent WEP. WEP has close to zero security and can be cracked by any monkey carrying a banana.

Debian adds wireless-tools by default with desktop or laptop installation. Check if you have these components, using aptitude:

aptitude show wireless-tools

If they are not installed for whatever reason add them now.

aptitude install wireless-tools

There's a Debian WiFi Wiki but its a little confusing.

Procedure overview

1. Ensure WiFi is switched on!
2. Identify your WiFi card/on-board chip.
3. Download drivers
4. Install modules (modprobe iwl3495)
5. edit /etc/network/interfaces
6. Add SSID and password
7. Change file permissions 0600. Only root can see password/passphrase.
8. Add user to netdev group if not a member
9. Bring up interface
10. Add nameservers to resolv.conf

Steps in detail

1. Ensure WiFi is switched on!

My laptop (and maybe others) have a physical switch on the outside of the laptop case to switch on WiFi. Check if you have similar, then set it to 'on'. This gave me some trouble at one point.

2. Identify your WiFi device

Check your owner manual, manufacturer website, Google laptop specification online, or dmesg

dmesg | less

Scroll through till you find a reference to your WiFi chip . When you know your device go over to Debian Wiki a look at the list of devices and drivers. You should find your chip and the associated driver.

I have an Intel PRO/Wireless 3945 which uses iwl3945 driver.

3. Download driver

You need the wifi modules from Intel's WiFi Linux drivers site. The info on the site states the driver is included in all kernels from 2.6.24. My laptop runs the 2.6.32 kernel, but it still did not recognise the card and attach the driver. I had to download and add them manually.  Go to driver downloads and pull them down.

4. Install driver module

Unzip driver

gunzip iwlwifi-3945-ucode-

The driver has two parts. Copy the driver to /lib/firmware

cp iwlwifi-3945* /lib/firmware

Install the driver

modprobe iwl3495

5. Edit /etc/network/interfaces

As root open /etc/network/interfaces in Emacs, Vi, or what editor you prefer and add the following:

auto wlan0
iface wlan0 inet dhcp
    wpa-ssid network-name (your network name goes here)
    wpa-psk passphrase (your password goes here)

6. Change permissions 0600

As a security measure, change permissions on the file.

chmod 0600 /etc/network/interfaces

Only root can see the password in the file.

7. Add user to netdev group

Check if you are a member of the netdev group

grep /etc/group

Output should display username


If not a member, add yourself

adduser obama netdev

8. Bring up interface

Get the interface working

# ifup wlan0

9. Add nameservers

Add Google DNS servers to resolv.conf

emacs /etc/resolv.conf


Save and quit.

10. Test Connections

Your home and dry. Or at least you should be. To test your connection, ping google or yahoo.



On next reboot, wireless interface will start automatically.


Copying Files Across Network

From Here To There

Copying files across machines is a simple matter of running a 'cp' copy command. Trusted old workhorse 'cp' has been replaced with 'scp' for copying files securely across a network. With the lack of trust in modern computing, passing raw data across a network is verboten. Data is encrypted before its copied from host to host.

Before you can copy files across, you must have an account or username for both machines or you will not be able to copy. When you start the copy, the destination machine will ask for username and password. Err, think security.

I am logged in on host firstbox and want to copy dumb.txt file to secondbox across a network, and put the file in my home directory, do:

scp dumb.txt jon@secondbox/home/jon

or if you don't know the machine name use its ip address:

scp dumb.txt jon@

Copy two files across:

scp one.jpg two.jpg jon@secondbox/home/jon

Copy a directory called dumbdir and its contents, use -r to copy recursively:

scp -r /dumbdir jon@secondbox/home/jon

To copy from Windows box to Linux box, use Putty.

You can also try PSCP or WinSCP.



Time And Again

XClock is a throw back to the early days of computing. Running a primitive X client seems like an odd idea when you have many other fancy clocks, modules, and toys to clutter your desktop and waste CPU cycles.

XClock is a simple program with an analog or digital display. Its easy to run. Easy to read. And easy on your system. You can have any color you like as long as its a default X color.

I normally run XClock same color as the desktop (dark) and contrast the hands and tick marks (light). You can set colors in your .Xresources or .Xdefaults, and have XClock start at login. I prefer simple (i.e. fast) components to pretty (slow) units.

You can also set the size and position of XClock in .Xresources or .Xdefaults.

Take a look:

XClock.Clock.hourColor: white
XClock.Clock.minuteColor: white
XClock.Clock.secondColor: white
XClock.Clock.majorColor: white
XClock.Clock.minorColor: white
XClock.Clock.background: black

XClock*geometry: 200x200+1760+0

You must merge changes to .Xresouces with xrdb.


xrdb -merge .Xresources


Running xrdb -merge command adds your changes to the X Resouces DataBase.

200x200 is XClock size. 1760+0 is the position. Experiment and see how you get on.

* * *

Lost Root Password

Lock Out

Forgot your 'root' user password? Can't login to your system? There's still hope for ya. To gain access to your machine or to reset the lost 'root' password, depends on the boot loader on your machine.

If you have GRUB boot loader, select a boot entry and hit 'E' to edit. Then add '1' or 'single' to the end of the command. Hit enter to finish editing and 'B' to boot.

If you have LILO, type 'linux 1' or 'linux single' at the boot prompt.

If you need a password to access runlevel '1', add /init/bin/bash to the end of the command line.


This boots the system to a command prompt without startup scripts.

Manually mount '/' root file system as read/write:

mount -o remount,rw /

Once the systems is at the command prompt, edit /etc/shadow to remove encrypted password field. Normally second field of the first line.

vi /etc/shadow

After changes are saved, reboot system and use password command to create new password for root user.

passwd root


Debian NTFS Partition

Mount It

You know the scene. Your running Debian Linux and have an old NTFS disk laying around that still has some interesting data still on it from way back when. You don't use windows anymore but still want to access the drive to pull stuff off.

If your NTFS drive was not setup at install, here's how to do it in Debian. Assuming the drive is already connected to your machine.

The steps are simple. As user root:

1. Install ntfs-3g
2. Identify the NTFS drive
3. Make directory to mount NTFS partition
4. Add user to fuse group
5. Edit /etc/fstab to automount partition at reboot
6. Add new entry for ntfs partition
7. Mount it manually for immediate access

My drive was /dev/sdb

Okay, let's do it:

1. aptitude install ntfs-3g
2. fdisk -l | grep NTFS
3. mkdir /media/ntfs
4. useradd -a -G fuse patrick
5. emacs /etc/fstab
6. /dev/sdb1 /media/ntfs ntfs-3g defaults 0 0
7. mount -a


My NTFS partition was identified as /dev/sdb. I mount it as /dev/sdb1.
Entries in /etc/fstab are separated by a single tab.
Last two entries in /etc/fstab are both zero (not oh).

As a point of interest the term mount in Unix/Linux speak meaning to connect a drive to the system historically comes from the early days of computing when large round ferric cores had to be mounted on the computer. Back then computers were bigger than washing machines or fridges. You probably seen them in old movies or photos.


Chrome Install On LXDE


After a recent clean install of Debian and LXDE, I tried to install Chrome browser with no luck. I went to Chrome download site and pulled down the latest *.deb file for a 64-bit system.

When I tried to install using aptitude or dpkg, the system would have none of it. I googled and found instructions on one of the forums.

Suggestions included using the Google repository. This required adding the following to /etc/apt/sources.list

deb stable main non-free
deb testing main non-free

Update aptitude package list

aptitude update

As a security measure, the system would not pull download and install any software till Google Chrome servers were authenticated. This required installing a key:

wget -q -O | apt-key add -

It took a few attempts before the key was finally and added.

Next I added the key to Gnupg keyring:

gpg --keyserver --recv A040830F7FAC5991 && gpg --export --armor A040830F7FAC5991 | apt-key add -

There was a long pause while GnuPG connected with the key server and downloaded the key.

gpg: requesting key 7FAC5991 from hkp server
gpg: key 7FAC5991: public key "Google, Inc. Linux Package Signing Key " imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg:               imported: 1

Once the key was on the keyring, I could download software from Google Chrome servers without complaints.

aptitude install google-chrome-stable

Or if you want to run the testing version.

aptitude install google-chrome-unstable

This may be a little buggy still.

In minutes Chrome was up and running. And damn quick it is too.

Previous Chrome extensions slowed the browser down to a crawl. This time, the only extension I add is adblock.

* * *

XFCE Desktop Notes

Some Adjustments

Following a recent clean install of Debian, I added LXDE and XFCE desktops to allow usage comparison. Switching between them after a couple of days allows assessment of usability, functionality, eye-candy, and response.

Both are light 'n' fast. There are a lot of features in Gnome and KDE that I don't need or I don't use. I don't need much from a desktop and don't use many bells 'n' whistles. I avoid clutter, and look for a fast, responsive desktop/window manager hybrid with minimal features.

I work mainly in Emacs, XTerm and Chrome (or Firefox/Iceweasel). If I could work without a mouse, I would. But I haven't been able to crack that one yet. Browsers are geared towards  mouse selection. Keyboard selection is difficult, but that's a post for another day.

XFCE and LXDE have a number of useful features, such as:

1. Mouse wheel on desktop switches workspace
2. Drag browser off screen moves window to next workspace
3. Edge resistance adjustment
4. Window border snap adjustment
5. Focus to follow mouse
6. Mouse wheel on Title Bar rolls up window

XFCE by default opens all windows in center screen. It stacks XTerms on top like a deck of cards. To change this, open 'Window Manger Tweaks' from the main menu.

Click Mouse > Settings > Window Manager Tweaks > Placement

Adjust the slider marked 'Minimum size of windows to trigger smart placement:', to the left to  reduce window size.

I guess the most impressive feature of both XFCE and LXDE is fast response.