Guide updated on 29th of February 2016

Create needed users/groups

After this step, you should have all the needed user and groups created as well as all the needed directories, permissions and ownership settings needed for the installation of qmail, ucspi-tcp and daemontools

Rather than being a single program, Qmail is a collection of smaller programs doing specific tasks. Each run as their own user to provide further security to your server - those users need to be created.

One thing to note - the numeric UID/GID values used by qmail and vpopmail are hard-coded into the programs when they are compiled. If you backup and restore your mails onto a different server (sample on this page), the UID and GID MUST HAVE THE SAME NUMERIC VALUE ON BOTH SERVERS! The easiest way to ensure this is to manually specify the values when the users and groups are created.

Check your /etc/passwd and /etc/groups files first to make sure the numbers given here aren't used. Most Linux systems use numbers >500 for "regular" users and <100 for "system" so we've picked a middle ground.

If you choose another UID/GID, do not forget to replace 89 when you 'll configure courier-authlib.

groupadd -g 161 nofiles
groupadd -g 162 qmail
groupadd -g 89 vchkpw

useradd -u 161 -g nofiles -d /var/qmail/alias -s /usr/sbin/nologin -c 'QMail alias user' alias
useradd -u 162 -g nofiles -d /var/qmail -s /usr/sbin/nologin -c 'QMail daemon user' qmaild
useradd -u 163 -g nofiles -d /var/qmail -s /usr/sbin/nologin -c 'QMail log user' qmaill
useradd -u 164 -g nofiles -d /var/qmail -s /usr/sbin/nologin -c 'QMail password user' qmailp
useradd -u 165 -g qmail -d /var/qmail -s /usr/sbin/nologin -c 'QMail queue user' qmailq
useradd -u 166 -g qmail -d /var/qmail -s /usr/sbin/nologin -c 'QMail remote user' qmailr
useradd -u 167 -g qmail -d /var/qmail -s /usr/sbin/nologin -c 'QMail send user' qmails

useradd -u 89 -g vchkpw -d /home/vpopmail -s /usr/sbin/nologin -c 'Vpopmail (virtual domains) user' vpopmail

mkdir /var/qmail
mkdir /usr/src/qmail
mkdir -p /var/log/qmail/qmail-send
mkdir -p /var/log/qmail/qmail-smtpd
mkdir -p /var/log/qmail/qmail-smtpdssl
chown -R qmaill:root /var/log/qmail
chmod -R 750 /var/log/qmail

Note that /var is normally a strange place to install programs. Dan Bernstein has a FAQ at to explain why he chooses this location (

Install qmail, ucspi-tcp and ucspi-ssl

Users comments
Peter smith - 09/08/2014 16:58

Dear Thibs,

Thanks all your great effort.

The debian wheezy version works great.

Will report any outstanding issue after the testing.

Thank you Indeed.

Peter Smith


Color Coded Qmail Installation Key
  Regular Black Text     Qmail installation notes and summaries by the author.
  Bold Black Text     Commands to be run by you, the installer.
  Bold/Regular Red Text    Vital and/or critical information.
  Regular Blue text     Denotes helpful tips and hints or hyperlinks.
  Regular Orange Text     Command line output.
  Bold/Regular green text     Denotes the contents of a file or script.