HOWTO: Use znc with an iPhone to connect to IRC

znc Setup

Determine Port

znc needs a unique port per user. To keep port numbers unique and alleviate confusion, generate the port via your UID.

If you don't know what a port or UID is, don't worry. Just run these commands

mindfill:~ [9] % printf "USE THIS PORT: 4%04d\n" $(id -u)

Don't use my port. Use your port. Run this command and use the port it shits out. If an existing znc service is running already, it won't work if you use a dupe port.

znc --makeconf

Follow this output, substituting your own information at the appropriate prompts.

The user and password field doesn't have to be the same as your UNIX (login) account. You will have to have the password hash stored somewhere (possibly insecure) so I'd recommend not reusing any password from another place.

If you're connecting from mindfill, it makes no sense to add more servers than, since that is the local ircd, and if mindfill is down, you won't need a backup server since znc itself will be dead.

mindfill:~ [13] % znc --makeconf
** Building new config
** First let's start with some global settings...
?? What port would you like znc to listen on? (1 to 65535): 41001
?? Would you like znc to listen using SSL? (yes/no) [no]: 
?? Would you like znc to listen using ipv6? (yes/no) [yes]: no
?? Listen Host (Blank for all ips): 
   Verifying the listener... ok
** -- Global Modules --
** +-----------+----------------------------------------------------------+
** | Name      | Description                                              |
** +-----------+----------------------------------------------------------+
** | partyline | Internal channels and queries for users connected to znc |
** | webadmin  | Web based administration module                          |
** +-----------+----------------------------------------------------------+
** And 6 other (uncommon) modules. You can enable those later.
?? Load global module <partyline>? (yes/no) [no]: 
?? Load global module <webadmin>? (yes/no) [no]: 
** Now we need to set up a user...
** znc needs one user per IRC network.
?? Username (AlphaNumeric): andy
?? Enter Password: 
?? Confirm Password: 
?? Would you like this user to be an admin? (yes/no) [yes]: 
?? Nick [andy]: 
?? Alt Nick [andy_]: 
?? Ident [andy]: 
?? Real Name [Got znc?]: andy
?? Bind Host (optional): 
?? Number of lines to buffer per channel [50]: 
?? Would you like to keep buffers after replay? (yes/no) [no]: yes
?? Default channel modes [+stn]: 
** -- User Modules --
** +-------------+-------------------------------------------------------------------+
** | Name        | Description                                                       |
** +-------------+-------------------------------------------------------------------+
** | admin       | Dynamic configuration of users/settings through IRC               |
** | chansaver   | Keep config up-to-date when user joins/parts                      |
** | keepnick    | Keep trying for your primary nick                                 |
** | kickrejoin  | Autorejoin on kick                                                |
** | nickserv    | Auths you with NickServ                                           |
** | perform     | Keeps a list of commands to be executed when znc connects to IRC. |
** | simple_away | Auto away when last client disconnects                            |
** +-------------+-------------------------------------------------------------------+
** And 20 other (uncommon) modules. You can enable those later.
?? Load module <admin>? (yes/no) [no]: 
?? Load module <chansaver>? (yes/no) [no]: 
?? Load module <keepnick>? (yes/no) [no]: 
?? Load module <kickrejoin>? (yes/no) [no]: 
?? Load module <nickserv>? (yes/no) [no]: 
?? Load module <perform>? (yes/no) [no]: 
?? Load module <simple_away>? (yes/no) [no]: 
** -- IRC Servers --
** Only add servers from the same IRC network.
** If a server from the list can't be reached, another server will be used.
?? IRC server (host only):
?? [] Port (1 to 65535) [6667]: 
?? [] Password (probably empty): 
?? Does this server use SSL? (yes/no) [no]: 
?? Would you like to add another server for this IRC network? (yes/no) [no]: 
** -- Channels --
?? Would you like to add a channel for znc to automatically join? (yes/no) [yes]: no
?? Would you like to set up another user (e.g. for connecting to another network)? (yes/no) [no]: no
   Writing config [/home/andy/.znc/configs/znc.conf]... ok
** To connect to this znc you need to connect to it as your IRC server
** using the port that you supplied.  You have to supply your login info
** as the IRC server password like this: user:pass.
** Try something like this in your IRC client...
** /server <znc_server_ip> 41001 andy:<pass>
** And this in your browser...
** http://<znc_server_ip>:41001/
?? Launch znc now? (yes/no) [yes]: no

Additional configuration

The following items should definitely be set in znc.conf.

MultiClients = true
KeepBuffer = true
LoadModule = route_replies

Make sure they are set under your network before you run znc.

Run znc

mindfill:~ [38] % znc
[ ok ] Opening Config [/home/andy/.znc/configs/znc.conf]... 
[ ok ] Binding to port [41001] on host [] using ipv4... 
[ ** ] Loading user [andy]
[ ok ] Adding Server [ 6667 ]... 
[ ok ] Forking into the background... [pid: 21994]
[ ** ] znc 0.202 -

Connect irssi to znc

You might want to make a new profile with the same tag as the old one so that your logs go to the same place (if you care about that sort of thing):

(Inside irssi)

/server delete
/server add -network scorched -auto <znc_server_ip> <znc_server_port>  <znc_server_user>:<pass>
/server add -network scorched_real -noauto

You can now connect to more than one znc network by doing something like:

/connect localhost <znc_server_port znc_username/network_name:znc_password

But you will have to set that network up separately in znc either with AddNetwork or by editing ~/.znc/configs/znc.conf and calling Rehash.

Maintenance tasks

Kill znc

mindfill:~ [76] % ps -aef | grep $(id -un) | grep znc | awk '{print $2}' | xargs kill

Config file location


Edit config file

Save the running config, edit it, then reload it.

mindfill:~ [74] % ps -aef | grep $(id -un) | grep znc | awk '{print $2}' | xargs kill -USR1
<edit config file>
mindfill:~ [75] % ps -aef | grep $(id -un) | grep znc | awk '{print $2}' | xargs kill -HUP

Note: if this doesn't work and your config changes aren't getting picked up, just restart znc.

Changing password

This is the password that you use to connect to znc from irssi.

mindfill:~ [65] % znc -s
[ ?? ] Enter Password: 
[ ?? ] Confirm Password: 
[ ** ] Use this in the  section of your config:
[ ** ] Pass = sha256#c99ba6734fd91f368cc93ea23384875dfdde02f1d24b39da3b851ddc0457018b#7siHvI*XcPC0vr!hlCXw#

Reload znc using the above procedure.

Connect your iPhone

Figure it out yourself; you can just use the same procedure as you did with irssi, with whatever client you prefer.