outpaddling / desktop-installer

Quickly configure a FreeBSD or NetBSD desktop system
BSD 2-Clause "Simplified" License
54 stars 7 forks source link

Error message on console #32

Closed dr3mro closed 8 months ago

dr3mro commented 8 months ago

in freeBSD 14rc4 there is a bug the /var/log/messages is spamed by the cronjob that launches batteryshutdown.sh

Nov 10 02:29:00 x270 nologin[45278]: Attempted login by root on UNKNOWN
Nov 10 02:30:00 x270 nologin[46126]: Attempted login by root on UNKNOWN
Nov 10 02:31:00 x270 nologin[47077]: Attempted login by root on UNKNOWN
Nov 10 02:32:00 x270 nologin[48513]: Attempted login by root on UNKNOWN

the calibrate is at line 49

su -l $user -c 'env DISPLAY=:0 xhost +local:root' > /dev/null || true

fixed in this pull req please accept https://github.com/outpaddling/desktop-installer/pull/33

dr3mro commented 8 months ago

fix

for user in $display_users; do
    if [ $(finger $user | grep -c nologin) -eq 1 ] ; then
       su -l $user -c 'env DISPLAY=:0 xhost +local:root' > /dev/null || true
    fi   
done
outpaddling commented 8 months ago

Thanks for the report. I'm not clear on how a user with shell set to nologin can have DISPLAY set. Is there some special configuration on your system?

In any case, I added a patch similar to your suggestion, but ensuring that only the shell is checked for nologin rather than all finger output. You can install from https://github.com/outpaddling/freebsd-ports-wip, or just manually grab the battery-shutdown script from this project.

dr3mro commented 8 months ago

the patch you did need a second thought .. there is a typo you should you fgrep -v if awk -F : -v user=$user '$1 == user { print $7 }' /etc/passwd | fgrep -v nologin; then

outpaddling commented 8 months ago

You're right, I had meant to put a ! in there. I think this is more readable than fgrep -v.