Bug 1956228

Summary: Systemctl fail starting service when username starts by a numerical digit.
Product: Red Hat Enterprise Linux 8 Reporter: Bruno Gillet <bgillet>
Component: systemdAssignee: systemd-maint
Status: CLOSED DUPLICATE QA Contact: Frantisek Sumsal <fsumsal>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.3CC: dtardon, systemd-maint-list
Target Milestone: beta   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-03 11:14:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Service unit file used to replicate the issue none

Description Bruno Gillet 2021-05-03 08:49:10 UTC
Created attachment 1778870 [details]
Service unit file used to replicate the issue

Created attachment 1778870 [details]
Service unit file used to replicate the issue

Description of problem:

When a username starts with numerical digits in a systemd unit file (ie. username = 00abc), systemctl rejects any action on the service with the following error :

Invalid user/group name or numeric ID: 00abc

If user name is reverted to a non numerical prefixed one (ie. abc) service may be managed (start/status/stop) without any problem.

Version-Release number of selected component (if applicable):

systemd 239 (239-41.el8_3.2)
shadow-utils-4.6-11

How reproducible:

Staright forward : Set up an up-to-date RHEL 8.3 VM, create a numerically prefixed user, set a service unit file with that user. Service start or status will fail. Try the same with a non numerically prefixed user, it will work.

Steps to Reproduce:
1. Set up a RHEL8.3 VM, update it.
2. Create a numerically starting user (00git in our replication)
3. Set up a service with this user name (gitea in ur replication)
4. try to get it's status or start it then you will get the following error (from our replication):

[root@rhel83-tst ~]# systemctl status gitea
- gitea.service - Gitea (Git with a cup of tea)
   Loaded: bad-setting (Reason: Unit gitea.service has a bad unit file setting.)
   Active: inactive (dead)

mai 03 04:25:26 rhel83-tst systemd[1]: /usr/lib/systemd/system/gitea.service:9: Invalid user/group name or numeric ID: 00git

5. change user to non numerically starting, then it works (git in our replication)

Actual results:

systemctl fails for managing that service, rejecting the username as invalid.

Expected results:

systemctl should work as planned to start, stop or get a service status.

Additional info:

This is not related to full numeric username that are obviously not supported.
Numerically prefixed username should work.
Attached is the gitea.service unit file used in our replication test.

Comment 1 David Tardon 2021-05-03 11:14:02 UTC

*** This bug has been marked as a duplicate of bug 1848373 ***