To create new wiki account, please join us on #znc at Libera.Chat and ask admins to create a wiki account for you. You can say thanks to spambots for this inconvenience.


From ZNC
Revision as of 20:00, 31 March 2017 by MAGIC (talk | contribs) (Update to latest version provided by
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This article describes how to run ZNC in a chroot-environment on Debian.

1. Compile and install ZNC normally.

Details: Installation

2. Add a new user for ZNC

Example: bouncer

adduser bouncer

3. Login as "bouncer" and configure ZNC normally for this user.

Details: Configuration

4. Change back to "root" and create a directory for the chroot environment.

Example: /var/chroot/

mkdir /var/chroot

5. Create the following subdirectories:

/var/chroot/ +


6. Change into the newly created "home"-directory and run:

chown bouncer:bouncer bouncer

7. Change into the newly created "dev"-directory and run:

mknod -m 644 random c 1 8
mknod -m 644 urandom c 1 9
mknod -m 666 null c 1 3

8. Run "ldd znc" to get the names of the needed libs.

Example: =>  () => /lib/tls/i686/cmov/ () => /usr/lib/i686/cmov/ () => /usr/lib/i686/cmov/ () => /usr/lib/ () => /lib/tls/i686/cmov/ () => /lib/ () => /lib/tls/i686/cmov/ ()
/lib/ () => /usr/lib/ ()

9. Copy all needed files.

cp /lib/mylibname /var/chroot/lib/
cp /usr/lib/mylibname /var/chroot/usr/lib/

Be sure that you missed no file!

10. You need to copy the following files to get DNS working.

/lib/ (May also be somewhere else, ask locate)
/lib/ (May also be somewhere else, ask locate)

11. Copy ZNC files.

cp /usr/local/bin/znc* /var/chroot/usr/local/bin/
cp -r /usr/local/share/znc /var/chroot/usr/local/share/
cp -r /usr/local/lib/znc /var/chroot/usr/local/lib/

12. Change to "bouncer" user and copy config files.

cp -r /home/bouncer/.znc /var/chroot/home/bouncer/

13. Change to "root" user.

You now can start ZNC with:

start-stop-daemon --chroot /var/chroot/ --chuid bouncer:bouncer --start --exec /usr/local/bin/znc

And stop it with:

start-stop-daemon --chroot /var/chroot/ --chuid bouncer:bouncer --stop --exec /usr/local/bin/znc