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

Re: Permitting login on AWS serial console



On Wed, Oct 06, 2021 at 03:56:25PM +0100, Phil Endecott wrote:
> > sed -i -e '/ExecStart/s/agetty/agetty -a root/' \
> >     -e '/ExecStart/s/-p/-p -f/' \
> > 	/lib/systemd/system/serial-getty@.service
> 
> So I think that is intended to replace this:
> 
> ExecStart=-/sbin/agetty -o '-p -- \\u' --keep-baud 115200,38400,9600 %I $TERM
> 
> with
> 
> ExecStart=-/sbin/agetty -a root -o '-p -f -- \\u' --keep-baud
> 115200,38400,9600 %I $TERM
> 
> man agetty tells me that -a root means "autologin" and man login tells
> me that -f means "do not perform authentication".
> 
> Is there something I should do to make this apply only to ttyS0?
> (Is that a good idea? Not sure.)
> 
> But do I really want to edit /lib/systemd/system/serial-getty@.service ?
> Is that a "conf-file", or whatever the right terminology is? Isn't there
> a file in /etc or /usr/local that I should edit in preference to this one?

No, you don't need to edit /lib/systemd/system/serial-getty@.service.
You should instead create a drop-in config fragment for
serial-getty@ttyS0.service like the following:

# /etc/systemd/system/serial-getty@ttyS0.service.d/autologin.conf
[Service]
ExecStart=
ExecStart=-/sbin/agetty -a root -o '-p -f -- \\u' --keep-baud 115200,38400,9600 %I $TERM

After that, apply the change on the running system with the following,
run as root:
systemctl daemon-reload
systemctl restart serial-getty@ttyS0.service

noah


Reply to: