I am using 19.10 upgraded from 19.04. The OS was a virtual machine image downloaded from https://www.osboxes.org/ubuntu/ the downloaded image was 19.04 which I had upgraded to 19.10 There were some problems during upgrade which I managed to solve.ubuntu stuck on boot in after upgrade to 19.10 from 19.04 in vmware [end kernel panic not syncing:VFS:unable to mount root fs on block (0,0)]
The default passwords were https://www.osboxes.org/faq/what-are-the-credentials-for-virtual-machine-image/
I had a default administrator account osboxes.org which I removed and created a new user called debian (this I did on 19.10 after upgrading from 19.04)
During the use of machines before upgrade I probably had reset the root password which I forgot and after upgrading I had deleted the original user account osboxes.org. I had created a new user username:debian I forgot its password also.
So I thought of resetting root password as explained here https://md3v.com/linux-give-root-password-for-maintenance-lost-password
every thing worked perfectly I was able to reset the root password.
Now when I try to login from Gnome interface as root the updated password is not accepted as a result I am locked out.
How can I get out of this situation I don't see any error messages also. I set my root password as debian and this is not working.
Graphical root logins are not supported. This is separate from root logins in general, which work fine when enabled, though we usually discourage them since
sudo
gives you the same power and has some advantages (see below).The specific mechanism that's stopping you from logging in graphically as root--assuming you're entering root's password correctly--is that your display manager is configured not to allow them. You could attempt to reconfigure it so it does (your display manager is probably GDM). But even if you do, graphical root logins are likely to work very poorly if at all, because this is not a use case that is supported or tested in Ubuntu.
Graphical root logins should also be avoided because they involve running a lot of stuff as root unnecessarily. Even if they worked perfectly, users would still be well-advised never to use them under any circumstances. (This is why no effort has been undertaken to make them work in Ubuntu.)
When you log in graphically, you should do so as a non-root user. When--if--you log in as root, you should, and can, do so non-graphically. Although you could use the same method you used to set a password for root to set one for another user, you don't have to. Since you've enabled root logins, you can set a password for a non-root user efficiently and without rebooting:
Switch to a text-based virtual console by pressing Ctrl+Alt+F2.
(In general, Ctrl+Alt+Fn switches to the virtual console
ttyn
. When the virtual console you're switching from is text-based, you can omit Ctrl from this key combination, though you don't have to.)Log in by entering
root
as the username and the password you set for root as the password. This is a non-graphical login. Based on the information you've provided, there's no reason to expect this to fail.Run
passwd user
to set a password for some non-root user accountuser
. Replaceuser
with the actual username.Or run
adduser user
to create a new useruser
. Enter the requested information. The real important bit is the password, though most people will want to put something in for the full name field too.Switch back to the virtual console on which the GUI is running. This is usually
tty7
, so press Ctrl+Alt+F7.Log in as the user whose password you set.
Since you have the root account enabled, you can run
su
in a terminal to get a root shell from which you can run commands as root. Usesu -
if you want this to behave as an initial login shell. The shell you get fromsu
orsu -
lasts as long as you like (i.e., until you runexit
in it or otherwise quit it), but it is best to use it only for administrative tasks that a non-root user couldn't directly perform.su -c 'some-command'
runs a single command as root rather than starting a shell. (Whensome-command
is just one word, i.e. when there are no command-line arguments, you can omit the quotes.) When you usesu
, you enter root's password, as you would when logging in as root. You must enter it each time you runsu
.With that said,
sudo
andpkexec
--rather than root logins andsu
--are the generally recommended way to perform administrative actions on Ubuntu. I recommend you consider adding a non-root user to thesudo
group (an existing user or a new user), which makes that user an administrator. Then that user can run commands as root withsudo
(andpkexec
). One way to do this is to runusermod -a -G sudo user
in step 3 above. Or perhaps your existing non-root user account is already in thesudo
group; you can rungroups user
to check.To run a command as root with
sudo
, you would usually usesudo some-command
. Even whensome-command
consists of multiple words, it need not (and must not) be quoted. This is one of the ways thatsudo
is easier thansu -c
.You also do not have to enter your password every time; instead, you need only enter it to use
sudo
in a terminal where you have not usedsudo
in the last several minutes. This way, it is efficient to run commands as root only when you need to, because you can interleavesudo
commands with other commands, without having to type your password many times as you would withsu -c
instead ofsudo
, and without ending up running all commands entered into that terminal as root, as you would if you usedsu
to get a root shell.If you do want a root shell, you can get one with
sudo -s
, which is much like what you get fromsu
, orsudo -i
, which is virtually identical to what you get withsu -
.When you use
sudo
, you enter your password, not root's password. Therefore root need not have a password set; the root account can be "disabled," yet you can still run commands as root withsudo
.If you decide to switch entirely to this recommended method--that is, if you administer your system in the way most Ubuntu users (and a sizable fraction of Debian users) do--then you can then re-disable root logins by running
sudo passwd -dl root
. This will keep you from logging in as root or becoming root withsu
, but you can still become root withsudo
, including withsudo -i
.