error in commented-out NAME_REGEX

Bug #1982523 reported by Peter Abeln
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
adduser (Debian)
Fix Released
Unknown
adduser (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

The default /etc/adduser.conf contains the line:

    #NAME_REGEX="^[a-z][-.a-z0-9_]*\$"

Commenting this out in preparation of updating it does not work as expected:

    pra@PABELN-X1E:~$ grep NAME_REGEX /etc/adduser.conf; sudo adduser testuser
    NAME_REGEX="^[a-z][-a-z0-9_]*\$"
    adduser: Please enter a username matching the regular expression configured
    via the NAME_REGEX[_SYSTEM] configuration variable. Use the `--force-badname'
    option to relax this check or reconfigure NAME_REGEX.
    pra@PABELN-X1E:~$

This is due to the overeager escaping of the dollar sign, which has the undesired effect of requring that usernames end in `$`:

    pra@PABELN-X1E:~$ sudo adduser testuser$
    Adding user `testuser$' ...
    Adding new group `testuser$' (1002) ...
    Adding new user `testuser$' (1002) with group `testuser$' ...
    Creating home directory `/home/testuser$' ...
    Copying files from `/etc/skel' ...
    New password:

Removing the backslash escaping the terminal `$` corrects the issue:

    pra@PABELN-X1E:~$ grep NAME_REGEX /etc/adduser.conf; sudo adduser testuser
    NAME_REGEX="^[a-z][-a-z0-9_]*$"
    Adding user `testuser' ...
    Adding new group `testuser' (1002) ...
    Adding new user `testuser' (1002) with group `testuser' ...
    Creating home directory `/home/testuser' ...
    Copying files from `/etc/skel' ...
    New password:

I reported this for the `adduser` package because it seemed the closest match. The file /etc/adduser.conf is not owned by any package.

ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: adduser 3.118ubuntu5
Uname: Linux 5.10.102.1-microsoft-standard-WSL2 x86_64
ApportVersion: 2.20.11-0ubuntu82.1
Architecture: amd64
CasperMD5CheckResult: unknown
Date: Thu Jul 21 19:56:02 2022
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)

Revision history for this message
Peter Abeln (prapra) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in adduser (Ubuntu):
status: New → Confirmed
Revision history for this message
Benjamin Drung (bdrung) wrote :
Revision history for this message
Benjamin Drung (bdrung) wrote :

Thanks for reporting this bug. Reporting it against adduser was correct, since adduser creates and manages /etc/adduser.conf

Changed in adduser (Ubuntu):
importance: Undecided → Low
Revision history for this message
Benjamin Drung (bdrung) wrote :

Fixed in adduser 3.129ubuntu1 in Ubuntu 23.04 (lunar).

Changed in adduser (Ubuntu):
status: Confirmed → Fix Released
Changed in adduser (Debian):
status: Unknown → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.