Tag Archives: Linux useradd Error

Linux useradd Error: Creating mailbox file: File exists

If you get the error Creating mailbox file: File exists when you add a user with useradd under linux

It is possible that userdel xxx did not add -r when deleting the user, so only the user was deleted, but not the user’s configuration file

For example, the path of the configuration file is in /var/spool/mail/xxx

# userdel -r
Usage: userdel [options] LOGIN

Options:
  -f, --force                   force some actions that would fail otherwise
                                e.g. removal of user still logged in
                                or files, even if not owned by the user
  -h, --help                    display this help message and exit
  -r, --remove                  remove home directory and mail spool
  -R, --root CHROOT_DIR         directory to chroot into
  -Z, --selinux-user            remove any SELinux user mapping for the user