2

Is there a way to create a user with username admin?

When I tried to pick a username admin I got this error/ warning message.

The username you entered (admin) is reserved for use by the system. Please select a different one.

enter image description here

Please note that I have gone through this Q How to add an user called "admin", this Q is about creating a user with username admin after successful Installation.

My Q is about creating a user with username admin at Installation time itself.

Thoughts: If there is a way to Customize the ISO with tool/tools like CUBIC https://launchpad.net/cubic to alter the name in the error/ warning message?

Workarounds are welcome.

2

2 Answers 2

3

Sure, just comment out admin in the list of reserved usernames before launching the installer. You don't need to remaster the ISO for this, though you could if you wanted.

The graphical installer on the desktop ISOs for Ubuntu and most of its official derivatives is Ubiquity. This is the installer pictured in the screenshot shown in your question. It keeps a list of reserved usernames in /usr/lib/ubiquity/user-setup/reserved-usernames.

Boot from a live USB or live DVD. Select the option to try Ubuntu, rather than the option to install it, since you should modify that file before running the installer.

Then comment out the admin line in that file by placing # at the front of the line. One way to do this is to run this one command:

sudo sed -i.orig 's/^admin$/# &/' /usr/lib/ubiquity/user-setup/reserved-usernames

Or, if you prefer, you can open the file in a text editor and manually make and save your changes:

sudoedit /usr/lib/ubiquity/user-setup/reserved-usernames

After modifying the file, double-click on the icon on the desktop to install Ubuntu.

I've tested this with the Ubuntu 18.04.3 LTS (amd64) desktop image.

If you feel like remastering the ISO image to avoid having to do that, you can. Any of the popular methods should work, since you're just changing one file inside the squashfs image. But if you only need this for a handful of installations, it's probably not worth it, since you can just run that one sed command (or equivalent) each time before launching the installer.


When you use this method, an admin group will be created and it will be used as the admin user's primary group. The admin user's UID will be 1000, and the admin group's GID will be 1000 as well. I don't think you need to change this, but it's a good idea to be aware of its significance.

I presume you intend the user you create during installation and name admin to be an administrator of the system who is permitted to run arbitrary commands as root (or any user) with sudo. So it shouldn't be a problem that Ubuntu's /etc/sudoers still confers those privileges to members of the admin group as well as the sudo group, even though membership in the admin group is no longer a common or recommended way to give a user these privileges.

Ubuntu's default /etc/sudoers contains these lines:

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

You could comment out the %admin line if you wanted. Run sudo visudo to edit the file. But you really don't need to.


Even though it's easy to make the installer let you proceed with the username admin, I encourage you to consider the workaround of just not making a user called that, for two reasons:

  1. Creating a user called admin on Ubuntu, especially during installation, is not tested. In my limited testing, it doesn't seem to cause any problems, but I can't be sure it doesn't trigger or exacerbate any current or future bugs.

  2. admin is an easily guessed username. When examining the logs of Internet-facing SSH servers, I've noticed that admin is one of the nonexistent users that receive a high volume of automated illicit login attempts.

    It's often not necessary or worthwhile to keep usernames secret. But admin is both easily guessed and attractive-sounding to people who want to break into your system.

    Of course, some usernames, like root, are even more ubiquitous and attractive. This is why allowing root logins is discouraged, especially password-based logins.

If your motivation for using the name admin is that this username is hidden in some utilities or display managers, it's likely you can configure them to hide another name.

With that said, so long as you otherwise follow good security practices, including the use of strong passwords, I wouldn't expect any problems.

3
  • @PRATAP I hope it helps! Although I've covered the topic at some length, the actual instructions for how to do it are near the top of the answer. (I do suggest reading the rest though, since I try to cover some of the possible ramifications of having a user called admin.) Nov 14, 2019 at 16:59
  • @PRATAP That looks fine to me. Nov 14, 2019 at 17:09
  • @PRATAP Yes, that's what it looked like when I installed 18.04 to test this. I considered including screenshots in this post, but I decided against it, because when Ubiquity rejects admin (that is, when one does not modify /usr/lib/ubiquity/user-setup/reserved-usernames), it does so only when one tries to click continue on that screen, rather than immediately once admin is typed in. Anyway, it looks like this worked for you--I'm glad it helped! Nov 14, 2019 at 17:18
0

As far as I know there is no way to do so at installation time itself, but assuming the link above works (creating a user with username "admin" after successful installation), one workaround could be installing with a dummy username, add a user named "admin" after installation, and then removing your dummy user. Hope that helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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