Bug 1126411

Summary: RFE: useradd should strip leading/trailing spaces from groups given with -G/--groups
Product: [Fedora] Fedora Reporter: Matthew Miller <mattdm>
Component: shadow-utilsAssignee: Tomas Mraz <tmraz>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: pvrabec, tmraz
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-12-20 15:30:21 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:

Description Matthew Miller 2014-08-04 11:44:53 UTC
Description of problem:

If one provides a list of groups containing a space, you get an error. This is easy to do when a shell script calls out to useradd with user-provided data (see for example bug #1126365).


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

shadow-utils-4.1.5.1-8

How reproducible:

Inherent. (And documented in the man page.)


Steps to Reproduce:
1. sudo useradd foo --groups wheel,adm
2. sudo useradd bar --groups "wheel, adm"

Actual results:

First one works, but second says "useradd: group ' adm' does not exist".

Expected results:

Both should work -- strip leading or trailing spaces

Additional info:

groupadd does not permit the creation of groups containing spaces

Comment 1 Tomas Mraz 2018-12-20 15:30:21 UTC
We are not going to pursue this RFE at this point. If anyone wishes to work on this I'd suggest creating pull request on shadow upstream.

https://github.com/shadow-maint/shadow