When running netstart as regular user, the output looks something like this:
$ sh /etc/netstart iwn0 /etc/netstart[226]: /etc/soii.key: cannot open $(<) input sysctl: net.inet6.ip6.soiikey: Operation not permitted ifconfig: SIOCS80211NWID: Operation not permitted ifconfig: SIOCS80211WPAPSK: Operation not permitted etc... There was a privilege check present for a while (added by jasper in r1.170), but backed out by rpe in r1.181, as it turned out to break diskless setups, as /usr/bin/id might not be present during early boot. Diff below adds it back while checking first that id(1) is there. Index: netstart =================================================================== RCS file: /var/cvs/src/etc/netstart,v retrieving revision 1.198 diff -u -p -r1.198 netstart --- netstart 28 Apr 2018 22:38:32 -0000 1.198 +++ netstart 8 Jul 2018 16:48:01 -0000 @@ -201,6 +201,13 @@ defaultroute() { done } +# Make sure the invoking user has the right privileges. Check for presence of +# id(1) to avoid problems with diskless setups. +if [[ -x /usr/bin/id ]] && (($(id -u) != 0)); then + echo "${0##*/}: need root privileges" + exit 1 +fi + # Get network related vars from rc.conf using the parsing routine from rc.subr. FUNCS_ONLY=1 . /etc/rc.d/rc.subr _rc_parse_conf