2

First of all:

  • I know it's not a good practice. But I mainly use this VM to do crazy stuff and I'm tired of typing my password all the time. I'm also lazy and don't want to login manually. So please see this as an experiment.
  • This is not a duplicate of the later mentioned questions. continue to read and you know what I mean.
  • Why? Just Because! This is the only reason.
  • Yes, it's stupid and dangerous.
  • Yes, I won't use this anywhere else. It's just for fun.
  • Anyone else: DO NOT USE THIS!

Finally lets start:

I've followed the answers of Login as root on ubuntu desktop and How to enable root login?. They work an I'm able to login. As you can see:

root is bad, I know and don't care

But now comes the problem: As soon as I try to edit my /etc/gdm3/custom.conf, change AutomaticLogin=user to AutomaticLogin=root and restart, the ubuntu login screen won't show up anymore. It's getting stuck at this screen:

login

Now I'm not able to login at all.

How can I get this to work?

Logs can be found at: https://gist.github.com/janwiesemann/8f7c8d2e267c61d6c514da8ae734794f

2
  • 2
    Why would you want the GUI to run as root though? There are may programs, web browsers for example, that refuse to be run by root. I think this will actually make things harder for you, not easier. Just set a trivial password, one character perhaps, so it's easy to type.
    – terdon
    Aug 5, 2022 at 15:43
  • @terdon why? just because. There isn't a real reason. Its a VM for experiments I mainly use for stupid stuff. Its running on top of a Mac ans is never used for 'real' stuff. Aug 5, 2022 at 22:39

3 Answers 3

7

I am against it ... totally:

  • Many applications will refuse/stop working.
  • System security will be totally compromised from within ... All normal daily tasks e.g. recieving and opening emails, browsing websites and creating/removing directories and files ... etc. will become extremely dangerous.
  • Rescue mode will now ask you for a password when you want to drop to a root shell to recover your system.
  • You name it ... DANGEROUS.

But, I guess you are way past this point ... You already did it and you like it so much(DANGEROUS TEMPTATION) that you even want it it automatic! ... Automatic login reads the file:

/etc/pam.d/gdm-autologin

Which has a line to prevent root's auto login(Because it's dangerous) that looks like this:

auth    required    pam_succeed_if.so user != root quiet_success

There you have it ... You have been warned ... Evil smile :-) ... Please don't do it ... If you do it anyway, don't come here asking for help ... Because you did it on purpose.

1
  • Thanks, this works. I got Snapshots on my VM. I won't ask for help. ;-P Aug 5, 2022 at 22:48
0
$ sudo -i
[sudo] password for hannu: 
root@gflap:~# 

Where is the hard part if you are about to destroy your VM? ;-)

2
  • That's the reason why snapshots exists. Aug 5, 2022 at 22:31
  • That is one "use" for them, yes.
    – Hannu
    Aug 6, 2022 at 16:03
0

I work in a validation lab where most of the test commands must be run as root, and there are lots of restarts built into the test automation.

I found that the only way to consistently allow root to auto-login is to create the installation using a seed file that doesn't create a normal user to begin with. As almost all of our image management is automated anyways, I found this easy to implement, but I realize this may not be the solution for everyone.

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    May 25, 2023 at 14:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .