How can I create the root user and password, when none exists?
-
3Do you really mean 'root', or do you mean an admin (sudo) account? – user535733 Jan 13 '22 at 00:17
-
No. I am very novice. When I start up and boot into Ubuntu, it asks for User, then password. None was set up and I cannot find a way to create user and PW – rainpoodle Jan 13 '22 at 00:30
-
It could be a case of an OEM installation where you're supposed to configure a user and password in the first boot. This is the same as buying a new computer with Ubuntu preinstalled (or any other OS really). – ChanganAuto Jan 13 '22 at 10:03
1 Answers
On Ubuntu you don't sign into the root account directly If you need to run something as the root user, say apt-get update
, then you use sudo
instead. For example:
$ sudo apt-get update
[sudo] password for cocomac: <-- enter the password for your account here
... apt-get update runs as root user ...
If you really need a root shell, you can do sudo bash
:
$ sudo bash
[sudo] password for cocomac: <-- enter the password for your account here
root@computername:/home/cocomac# apt-get update
... apt-get update runs as root user ...
If for some strange reason sudo
doesn't work, you can give yourself the ability to use sudo
by doing the following.
Warning: by default,
sudo
should work just fine. So, it might be easier to just install Ubuntu yourself so that you know everything is setup correctly and with the normal defaults. Ifsudo
doesn't work, then either the technician did something strange when they installed Ubuntu (and probobly didn't tell you!), or something went wrong. In either case, it might be better to just reinstall Ubuntu yourself. That is what I suggest. If you want to try to fix it, here are the steps:
- Restart the computer. While it boots, hold down the Shift key. This will give you a grub menu.
- Select recovery mode. Choose the option to open a root shell, and run the following command, but replace
[username]
with the real username of your user.
# adduser [username] sudo
Then type exit
, and boot normally. You should be able to use sudo
.

- 3,394