From 37f1b5239126815df99a41a8d944cedbbbadbca9 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Sat, 25 Oct 2025 20:00:04 -0700 Subject: [PATCH] Don't try to run the last command if it's not installed https://github.com/webmin/webmin/discussions/2161 --- useradmin/linux-lib.pl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/useradmin/linux-lib.pl b/useradmin/linux-lib.pl index 678cb1a30..21b3acd76 100755 --- a/useradmin/linux-lib.pl +++ b/useradmin/linux-lib.pl @@ -21,9 +21,14 @@ return &password_file($config{'gshadow_file'}) ? 2 : 0; sub open_last_command { my ($fh, $user, $max) = @_; -my $quser = quotemeta($user); -$max = " -n $max" if ($max); -open($fh, "(last -F -w$max $quser || last -w$max $quser) |"); +if (&has_command("last")) { + my $quser = quotemeta($user); + $max = " -n $max" if ($max); + open($fh, "(last -F -w$max $quser || last -w$max $quser) |"); + } +else { + open($fh, "