1. Andrew's Corner »
  2. Linux Explorations...

Running irssi under the latest release of Ubuntu

I am both a student and a huge fan of the Internet Relay Chat (IRC) program irssi. This brief guide aims to give just a starting point for any like me who are keen to explore this amazing program. I shall do this by demonstrating how to install irssi, connect to Freenode with SSL and then access the #ubuntu channel. The guide has most recently been tested with irssi on Xenial Xerus but should work, perhaps with some small modifications, for most Ubuntu releases.

Getting started ...

One important point in this guide is that where you are required to fill in your own details for such things as passwords, email addresses etc I will mark the area in both red and italics, change this for your own details. First let us download some required files from the repository using the following single command:

sudo apt-get -y install irssi ca-certificates

This will only be a small download, now start the program with the command irssi and you should see some variation of the following screen:

14:20 -!-  ___           _
14:20 -!- |_ _|_ _ _____(_)
14:20 -!-  | || '_(_-<_-< |
14:20 -!- |___|_| /__/__/_|
14:20 -!- Irssi v0.8.19 - http://www.irssi.org
14:20 -!- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14:20 -!- Hi there! If this is your first time using Irssi, you
14:20 -!- might want to go to our website and read the startup
14:20 -!- documentation to get you going.
14:20 -!- 
14:20 -!- Our community and staff are available to assist you or
14:20 -!- to answer any questions you may have.
14:20 -!- 
14:20 -!- Use the /HELP command to get detailed information about
14:20 -!- the available commands.
14:20 -!- 
14:20 -!- For Ubuntu specific help type "/connect Ubuntu" and
14:20 -!- "/join #ubuntu" (without the quotes) and ask your
14:20 -!- question.
14:20 -!- - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Well that never makes a great first impression does it? Never fear we are now going to make things a little friendlier:

Connecting to Freenode and #ubuntu...

No doubt like most people (including me) you will ignore the polite note in this opening window encouraging you to first read some of the irssi documentation. At some stage I would suggest that this would be an excellent idea and perhaps sooner rather than later. So to start we need to set a nick, usually a pithy and fairly cool one, and your real name, don't forget to use your own details for "nick" and "Real Name":

/set nick nick 
/set real_name Real Name 

Then manually connect to Freenode as follows:

/connect irc.freenode.net 8001

Once connected then manually join #ubuntu by simply run the following:

/join #ubuntu

And there you are using irssi and joining real time chat! For the moment we will leave this channel:

/leave Put your witty parting shot here!!

This closes the active channel but leaves us still connected to Freenode so we can complete the setup.

Register with Freenode ...

It is a very good idea to formally register your nick with Freenode and it is easy enough to do. Don't forget to substitute your own details here:

/msg nickserv REGISTER password email

NickServ will send an email to your email address with copy and paste instructions to verify you nick details. So your email address is not obvious to all users (although this setting is usually the default) then issue the following command:

/msg NickServ SET HIDEMAIL ON

It is not mandatory but often a good idea to create an alternate nick and then group this with your account. So while logged on with your primary nick run the following:

/nick alternate_nick
/msg nickserv group

Finally check your setup with the following command:

/msg nickserv info

And that is the basics of our dealings with Freenode registration, although I would suggest that after 4 weeks you go to #freenode and ask for an unaffiliated cloak to shield your IP details from the curious. But now to automate the irssi connection and both connect with SSL and secure your password exchange with SASL.

Automatically connect with SSL/SASL ...

For the most secure connection it is best to connect with SSL and then shield the password verification with SASL. The exact method is slightly different depending on whether you are running irssi 0.8.18 or greater or if in fact you have an older version.

SASL for newer versions of irssi (0.8.18 and newer)

The latest versions of irssi have built in support for SASL authentication and this makes the setup a lot easier. First make sure you don't have the old script in place:

mv -v $HOME/.irssi/scripts/cap_sasl.pl $HOME/.irssi/scripts/cap_sasl.pl_bak    
rm -v $HOME/.irssi/scripts/autorun/cap_sasl.pl

From within irssi remove all of the old Freenode settings, this avoids a few misconfiguration pitfalls:

/SERVER REMOVE chat.freenode.net 6667 Freenode
/NETWORK REMOVE Freenode

And finally add the new settings in, ensuring that you add your username and password:

/SERVER ADD -auto -ssl -ssl_verify -ssl_capath /etc/ssl/certs -network Freenode irc.freenode.net 6697
/NETWORK ADD -sasl_mechanism plain -sasl_username username -sasl_password password Freenode
/channel add -auto #ubuntu Freenode
/save
/exit

Now restart irssi and if all is well you will see +Zi in the bar at the base of the irssi window and in the irssi connection dialogue you should also see something like the following:

20:35 -!- Irssi: SASL authentication successful

And now you can safely and securely join the irc community :).

SASL for older versions of irssi (pre 0.8.18)

Older versions of irssi need an external script to enable SASL authentication. First to download and place this script with the following single command:

mkdir -pv $HOME/.irssi/scripts/autorun
wget http://scripts.irssi.org/scripts/cap_sasl.pl -P $HOME/.irssi/scripts/
ln -sv $HOME/.irssi/scripts/cap_sasl.pl $HOME/.irssi/scripts/autorun/

Now load the script manually from within irssi and add in the required settings:

/script load cap_sasl.pl
/sasl set Freenode primary-nick password PLAIN
/sasl save
/save

Finally set irssi to automatically make an SSL connection to Freenode on startup and then automatically log on to #ubuntu:

/network add Freenode
/server add -auto -ssl -ssl_verify -ssl_capath /etc/ssl/certs -network Freenode irc.freenode.net 7000
/channel add -auto #ubuntu Freenode
/save
/exit

Perhaps you should also cross your fingers when you restart irssi? If all is well you will see +Zi in the bar at the base of the irssi window and in the irssi connection dialogue you should also see something like the following:

20:35 -!- Irssi: SASL authentication successful

And now find a few people to chat to and join the great irc community :).

Add a few more scripts ...

There is a wealth of scripts available to irssi users, some from a fine irssi repository and some more from external sources. It is probably best at the moment to avoid the scripts packaged for the Ubuntu Repositories as many of these are sadly out of date! I will outline a couple of decent scripts which will provide a start to your own exploration.

Irssi's Script Repository

The irssi community maintain a collection of scripts called the Irssi's Script Repository. It can be accesed manually but there is a semi-automated method of accessing these scripts using scriptassist.pl.

scriptassist.pl

This script can make your life a lot easier with irssi particularly is you are a little new to this great application. Installation can be done manually as follows:

mkdir -pv $HOME/.irssi/scripts/autorun/
wget http://scripts.irssi.org/scripts/scriptassist.pl -P $HOME/.irssi/scripts/
ln -sv $HOME/.irssi/scripts/scriptassist.pl $HOME/.irssi/scripts/autorun/

Now have a close look at what this script can do by typing the following in an irssi window:

/scriptassist help

To see it in action we will install another script, this one an advanced window management script:

adv_windowlist.pl

The script adv_windowlist.pl takes a step into deeper water perhaps but it will give a superior ability to navigate multiple channels as well as visualise them much more easily. You can read up on it and then install it using scriptassist:

/scriptassist info adv_windowlist
/scriptassist install adv_windowlist
/scriptassist autorun adv_windowlist
/toggle awl_viewer

The last command returns the viewer to statusbar mode, simply repeat the command to return to the external window. Now open the script itself with gedit and have a look at the myriad of options that can be used. You might then consider whether to remove the old 'Activity' window or not, the first command below removes it and the second restores it if you wish:

/statusbar window remove act
/statusbar window add -after lag -priority 10 act

On my own Xenial system I rid myself of the 'Network | Nick' block, resized the blocks available for channel names, changed the highlighting from Red to Cyan and lost the '=' sign in front of the channel names:

/format -delete awl_display_header
/set awl_block 18
/format awl_display_key_active %6$Q${cumode_space}$H$C$S

Many posibilities! Perhaps once you are used to adv_windowslist.pl you might cut the umbilical cord completely and disable the irssi default statusbar completely:

/statusbar window disable

But I will leave you, Gentle Reader, to spend as much time as you desire getting your configuration of adv_windowlist exactly as you would like, the details are contained within the script itself, simply open it with gedit and experiment away. You can now repeat this installation process for any one of the great scripts hosted on the Irssi's Script Repository!

External scripts...

There are many other scripts available from a wide variety of sites. One very worthwhile having a look at is hack-whois-in-current-window.pl.

hack-whois-in-current-window.pl...

This is a very simple script or hack which simply loads a /whois enquiry into the current window rather than opening the query in another window:

wget http://dgl.cx/irssi/hack-whois-in-current-window.pl -P $HOME/.irssi/scripts/
ln -sv $HOME/.irssi/scripts/hack-whois-in-current-window.pl $HOME/.irssi/scripts/autorun/

And the script is now yours, a script that I have used now for many years. Let me know of any other external scripts that you have found especially useful with irssi and I will roadtest them and then include them on this page.

And in conclusion ...

Experienced users of irssi and IRC know that I have omitted many, many areas that enhance the experience of using this great program. However hopefully I have furnished a strong starting point for inexperienced users who will subsequently explore the program a little more fully. And remember "Have Fun!!".