Public bug reported: The man page for the adduser utility clearly states the exit code behavior to be expected as:
EXIT VALUES 0 The user exists as specified. This can have 2 causes: The user was created by adduser or the user was already present on the system before adduser was invoked. If adduser was returning 0 , invoking adduser a second time with the same parameters as before also returns 0. 1 Creating the user or group failed because it was already present with other UID/GID than specified. The username or groupname was rejected because of a mismatch with the configured regular expressions, see adduser.conf(5). Adduser has been aborted by a signal. Or for many other yet undocumented reasons which are printed to console then. You may then consider to remove --quiet to make adduser more verbose. In actual operation, adduser returns 1 if the user already exists. The documented behavior would be preferable. System details: Description: Ubuntu 12.04.5 LTS Release: 12.04 adduser: Installed: 3.113ubuntu2 Candidate: 3.113ubuntu2 Version table: *** 3.113ubuntu2 0 500 http://us.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages 100 /var/lib/dpkg/status ProblemType: Bug DistroRelease: Ubuntu 12.04 Package: adduser 3.113ubuntu2 ProcVersionSignature: Ubuntu 3.13.0-49.81~precise1-generic 3.13.11-ckt17 Uname: Linux 3.13.0-49-generic x86_64 ApportVersion: 2.0.1-0ubuntu17.8 Architecture: amd64 Date: Mon Aug 31 16:43:48 2015 InstallationMedia: Ubuntu-Server 12.04.3 LTS "Precise Pangolin" - Release amd64 (20130820.2) MarkForUpload: True PackageArchitecture: all ProcEnviron: TERM=xterm-256color PATH=(custom, no user) LANG=en_US.UTF-8 SHELL=/bin/bash SourcePackage: adduser UpgradeStatus: No upgrade log present (probably fresh install) ** Affects: adduser (Ubuntu) Importance: Undecided Status: New ** Tags: amd64 apport-bug precise -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1490777 Title: adduser does not behave as documented in man page To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/adduser/+bug/1490777/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs