Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running Ubuntu 12.10 desktop 32 bit. Currently I have only a user, type administrator. I'd like to create another administrator user but I keep getting the following error:

Failed to create user

GDBus.Error:org.freedesktop.Accounts.Error.Failed: running '/usr/sbin/adduser' failed: /usr/sbin/adduser returned an error (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.

Any suggestion is appreciated.

share|improve this question
Could you please edit and tell us more specifically what you did to get this error. Was it a command? – Zilvador Dec 25 '12 at 22:00

You normally get this message if you are trying to create a user with a name that contains characters that are considered to be un acceptable as per your NAME_REGEX file. You can try again changing the username with the GUI or you can relax the check by using the command line with the following command.

sudo adduser --force-badname <username>

and then if you want to add the user to the sudo group run the following command.

sudo adduser <username> sudo
share|improve this answer
-1, I wouldn't encourage doing that. The restriction is probably in place for a reason. – nyuszika7h Aug 27 '14 at 15:28
@nyuszika7h I wonder how could this affect the system? Just looking for an example here since I create a user for my mail account. – sitilge Jun 15 '15 at 11:42

The username you're entering contains bad characters. Try entering a simple username containing only lower-case English letters - daniel is good, &&Daniel <*> Johnson## is not so good.

share|improve this answer

CoalaWeb's answer is correct, but if you don't want to make a custom group for that user... you can simply use the following command to create a user:

sudo useradd <username>


sudo useradd josh

...then rightly said by CoalaWeb, follow the command:

sudo adduser <username> <groupname>


sudo adduser josh sudo

...this will give the new user 'josh' sudo rights (super-user rights (aka admin))

...I would also add to the group called 'adm'.

hope this helps someone

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.