Project

General

Profile

Actions

Bug #10980

closed

``/etc/rc.local`` script content is executed at login instead of during boot sequence

Added by alzee bum about 4 years ago. Updated 8 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Operating System
Target version:
Start date:
10/15/2020
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
24.03
Release Notes:
Default
Affected Version:
Affected Architecture:
All

Description

See https://redmine.pfsense.org/issues/10978 for context.

/etc/skel/.profile is copied to .profile in all users home directories when they are created, including admin/root. This file contains a (incorrect? The test fails when you log in via SSH) test for interactive mode that executes /etc/rc.initial if the test returns false. In effect the goal seems to be to execute /etc/rc.initial whenever any user logs in non-interactively.

If this were working as intended the /etc/rc.initial script for every user who logs in, every time they log in, if that login was non-interactive. This seems like a mistake on it's face. However the script is not working as intended, and it is executed every time a user logs in, even interactively. This is easy to demonstrate by creating a simple /etc/rc.local script that echoes something to the console. The echoed message will be displayed every time you log in interactively.

The bigger issue is that /etc/rc.local should only be executed once, at boot. It should not be executed every time a user logs in, and it should not rely on a user to log in in order to be executed. This is a long-standing BSD init script that exists to facilitate simple startup routines that don't merit an entire rc.d style startup script in e.g. /usr/local/etc/rc.d/. I don't believe that pfSense ever uses /etc/rc.local for anything itself, and this bugs makes it difficult to use for admins as well.

Actions

Also available in: Atom PDF