Enjoying Open Source Software

Using a password file with the w3m browser

w3m is a very nice open source text-based web browser. With w3m you can browse web pages through a terminal emulator window. it features among others tab based browsing.

A not well known feature of w3m is the use of a password file. In this file you can provide credentials for several websites. This makes it possible to access those websites without having to log in

Location of the password file

The name and location of the password file can be set in the general config file of w3m.

Here is the default config:

passwd_file ~/.w3m/passwd

Format of the password file

With the following format I have been able to automaticly log in to my personal wiki:

realm <description of the realm>
login <username>
passwd <password>

If you want to add credentials for more hosts, simple append a blank line and add a new block with hostname, realm, etc.

To get the right description of the realm, simply use w3m to log on to the site. After the notification that credentials are needed, w3m shows the prompt "Username for", followed by thedescription of the realm. So you just make a literal copy of the text that follows after "Username for".

The documentation states that you can also add a port number, a local path and proxy.

Permissions of the password file

Make sure that the password file is only readable for the user (0600).

Tags: w3m