Re: Boot normally, but give me a root shell

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx> 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


-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux