opnsense-shell loginshell option is missing for new and existing users

Started by opnsenuser, January 01, 2024, 11:54:38 AM

Previous topic - Next topic
Hi,
when adding a new user to the firewall or an editing existing one the option to set the OPNsense console (/usr/local/sbin/opnsense-shell) as a loginshell is not available. This behaviour is observed on multiple current (2023.7.10_1) installations.
Can you please have a look at your installation(s) if it's the same?
Is it wanted behaviour?


BR

That shell if for root only.


function auth_get_shells($uid = 0)
{
    $shells = array('' => '/usr/sbin/nologin');

    if ($uid == 0) {
        $shells = array('' => '/usr/local/sbin/opnsense-shell');
    }

    $etc_shells = @file_get_contents('/etc/shells');
    if (!empty($etc_shells)) {
        $etc_shells = explode("\n", $etc_shells);
        foreach ($etc_shells as $shell) {
            $shell = trim($shell);
            if (
                !empty($shell) && strpos($shell, '#') !== 0 &&
                strpos($shell, '/usr/local/sbin/opnsense-') !== 0
            ) {
                $shells[$shell] = $shell;
            }
        }
    }

    return $shells;
}