On Fri, Oct 07, 2016 at 09:19:55AM +0200, Ahmad Samir wrote:
On 6 October 2016 at 23:55, Richard W.M. Jones rjones@redhat.com wrote:
Is there a way to get Fedora to boot into a root shell, without requiring a password?
NOTE: I'm not interested in "emergency" shells and this is not for recovering a system.
I want the (specialized, non-networked) system to boot as normal, all the way to multi-user.target, and then drop me to a root shell.
Rich.
This seems to work with multi-user.target set as the default target: # cd /etc/systemd/system/ # cp /usr/lib/systemd/system/getty@.service getty@tty1.service # sed -i -e 's!ExecStart=-/sbin/agetty!ExecStart=-/sbin/agetty --autologin root!' getty@tty1.service # systemctl enable --force getty@tty1.service
Thanks.
I came up with a slightly different answer, which also works. I'm just documenting it here for reference.
I copied debug-shell.service from systemd to /etc/systemd/system/root-shell.service. I modified the file as below because I wanted to start a root shell on /dev/console, and I also wanted the target to be multi-user.target.
I then enabled the service as usual:
# systemctl enable root-shell
On boot, it starts a root shell with no login required.
Rich.
---------------------------------------------------------------------- # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version.
[Unit] Description=Root shell Documentation=man:sushell(8) DefaultDependencies=no IgnoreOnIsolate=yes
[Service] Environment=TERM=linux ExecStart=/sbin/sushell Restart=always RestartSec=0 StandardInput=tty TTYPath=/dev/console TTYReset=yes TTYVHangup=yes KillMode=process IgnoreSIGPIPE=no # bash ignores SIGTERM KillSignal=SIGHUP
# Unset locale for the console getty since the console has problems # displaying some internationalized messages. Environment=LANG= LANGUAGE= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY= LC_MESSAGES= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= LC_MEASUREMENT= LC_IDENTIFICATION=
[Install] WantedBy=multi-user.target