Page MenuHomeFreeBSD

The daemon(8) -u option should set USER, HOME and SHELL environment variables
ClosedPublic

Authored by sobomax on Aug 12 2022, 12:02 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 8, 8:10 PM
Unknown Object (File)
Tue, Oct 29, 2:18 PM
Unknown Object (File)
Sep 26 2024, 3:13 AM
Unknown Object (File)
Sep 22 2024, 11:38 PM
Unknown Object (File)
Sep 22 2024, 2:14 PM
Unknown Object (File)
Sep 22 2024, 6:09 AM
Unknown Object (File)
Sep 21 2024, 1:47 PM
Unknown Object (File)
Sep 18 2024, 5:24 PM
Subscribers

Details

Summary

Unlike what su, jexec, sudo etc while running program under specific user, the daemon(8) does not set USER, HOME and SHELL environment variables just leaving them be at their current values. This is probably not what user expects in such situation.

Current behavior:

$ sudo daemon -u nobody printenv; sleep 1
[...]
USER=root
HOME=/root
SHELL=/bin/sh
[...]
Test Plan

Expected behavior:

$ sudo daemon -u nobody printenv; sleep 1
USER=nobody
HOME=/nonexistent
SHELL=/usr/sbin/nologin

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable