Bug#746442: Please make /etc/rc.local non-executable by default

Jonathan de Boyne Pollard J.deBoynePollard-newsgroups at NTLWorld.COM
Fri Nov 16 00:06:48 GMT 2018


KatolaZ:

> /etc/rc.local is expected to be executed by rc at the end of each 
> multiuser runlevel.
> [...]
> Removing the +x bit will break it immediately, and to no avail.

There is a bit of a myth that has grown up about /etc/rc.local in recent 
years, that it was executed "last".

* https://github.com/systemd/systemd/issues/7703

In fact, in Seventh Edition and 4BSD it was not.  /etc/rc invoked 
/etc/rc.local partway down, as books on Unix used to note.  This can 
still be seen in the OpenBSD /etc/rc, which still invokes it between 
invoking other stuff, and which calls out this misconception in its manual.

* https://github.com/openbsd/src/blob/master/etc/rc#L606

* https://man.openbsd.org/rc.local

FreeBSD /etc/rc hasn't even invoked /etc/rc.local at all, last or 
otherwise, since 1998.

In the van Smoorenburg rc system, where /etc/rc.local isn't invoked 
directly but is rather invoked by the /etc/init.d/rc.local backwards 
compatibility mechanism, it is /etc/init.d/rc.local not /etc/rc.local 
that is conventionally invoked via the "99" symbolic links in the 
/etc/rcN.d directories.   But insserv complicated this years ago.

Also note that it is only the backwards compatibility mechanisms in van 
Smoorenburg rc and systemd that care about the x bit.  It being unset 
did not in fact break the old BSD systems, which generally either 
sourced it with "." or passed it to a subshell with "sh /etc/rc.local", 
neither of which need execute permission.  The backwards compatibility 
mechanism in Mewburn rc sources it as well, and only tests for its 
existence not its executability.

* 
https://github.com/freebsd/freebsd/commit/eab2c349799b5be274b03a396e9730509da13f9d#diff-34187173865821c23c7e1b0807ea0ee5L339

* 
https://github.com/freebsd/freebsd/commit/11cc829faea7c94837080def42b5535946dd9357




More information about the Debian-init-diversity mailing list