snap create-user gets bad username

Bug #1603018 reported by Michael Nelson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snappy
Fix Released
Undecided
Unassigned
snapd (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

ubuntu@dev-xenial3:~⟫ sudo snap create-user <email address hidden>
error: bad user result: cannot create user michael.nelson: adduser failed with exit status 1: 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.

ubuntu@dev-xenial3:~⟫ curl -s https://<email address hidden> | jq .username
"michael.nelson"

ubuntu@dev-xenial3:~⟫ grep NAME_REGEX /etc/adduser.conf
#NAME_REGEX="^[a-z][-a-z0-9_]*\$"

Assuming the above commented out NAME_REGEX is the default, then create-user will fail for some usernames which launchpad/SSO allow.

Tags: create-user
Revision history for this message
Michael Nelson (michael.nelson) wrote :

Assuming we don't want people to have to change usernames on SSO/LP (sometimes not even possible, if people have packages published in PPAs - from memory?), I don't (yet) see any other option than to use the username with a period from SSO/LP (which is posix compliant [1]).

But can we be sure usernames with dots will be safe on other distros? (hopefully given it's within the standard). Or what other options are there?

I'd be happy to provide a fix if there's a decided direction.

[1] See points in http://askubuntu.com/questions/405638/what-are-the-disadvantages-of-having-a-dot-in-a-user-name#405668

tags: added: create-user
Revision history for this message
Steve Langasek (vorlon) wrote :

adduser has a --force-badname option that overrides this behavior. We should probably switch to using this.

We definitely don't want adduser to be enforcing different username rules than SSO does.

Changed in snapd (Ubuntu):
status: New → Fix Committed
Changed in snappy:
status: New → Fix Committed
Michael Vogt (mvo)
Changed in snappy:
status: Fix Committed → Fix Released
Changed in snapd (Ubuntu):
status: Fix Committed → 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.