Here are the results of the cat:
#cat /root/LUM/lum.sh
#!/usr/bin/bash
#----------------------------------------------------------
# Linux Update Manager
# desc: This script is used with the Linux Update Manager tool
# This tools scans for packages
# needing updates and the status of the linux host.
#
scriptVersion=1.0.25
#
#
#---------------------------------------------------------
if [ $EUID -ne 0 ]; then
echo "ERROR: Must be run as root"
exit 1
fi
deb=(ubuntu debian raspbian kali linuxmint)
rhe=(fedora rocky centos rhel amzn arch opensuse)
distroID=$(. /etc/os-release; echo $ID)
distroIDLIKE=$(. /etc/os-release; echo $ID_LIKE)
PM="apt"
if [[ " ${deb[*]} " =~ " ${distroID} " ]]; then
PM="apt"
elif [[ " ${deb[*]} " =~ " ${distroIDLIKE} " ]]; then
PM="apt"
elif [[ " ${rhe[*]} " =~ " ${distroID} " ]]; then
PM="yum"
else
PM="yum"
fi
CMD=$1
REBOOT=0
if [[ "$CMD" == *"SCAN"* ]]; then
if [[ "$PM" == *"apt"* ]]; then
a=$(apt-get --just-print upgrade 2>&1 | perl -ne 'if (/Inst\s([\w,\-,\d,\.,~,:,\ ] )\s\[([\w,\-,\d,\.,~,:,\ ] )\]\s\(([\w,\-,\d,\.,~,:,\ ] )\)? /i){print "\(\"39\", \"8423\", \"$1\", \"$2\", \"$3\"),"}')
elif [[ "$PM" == *"yum"* ]]; then
update=$(yum check-update)
installed=$(yum list installed)
a=$(awk 'BEGIN {FS=OFS=" "} NR==FNR {v[$1]=$2; next} {print (v[$1] ? "(\"39\",\"8423\", \"" $1 "\",\"" $2 "\",\"" v[$1] "\")," : "")}' <(echo "$update") <(echo "$installed") | column -t)
else
exit 1
fi
echo -n $a | sed 's/.$//'
elif [[ "$CMD" == *"TESTREBOOT"* ]] ; then
if [[ "$PM" == *"apt"* ]]; then
PM="apt"
PMV=$(apt -v |awk '{print $2}')
if [ -f /var/run/reboot-required ]; then
REBOOT=1
fi
elif [[ "$PM" == *"yum"* ]]; then
PM="yum"
PMV=$(yum list installed | grep yum.noarch | awk '{print $2}')
if ! command -v needs-restarting &> /dev/null
then
yum install yum-utils -y
fi
TESTREBOOT=$(needs-restarting -r)
if [[ $TESTREBOOT == *"Reboot is probably not necessary"* ]]; then
REBOOT=0
else
REBOOT=1
fi
else
exit 1
fi
ba='("39", "8423", "STG-COLO-UNMS", "Scout", "'$REBOOT'", "'$PM'", "'$PMV'",NOW())'
echo -n "$ba"
elif [[ "$CMD" == *"UPDATE"* ]] ; then
if [[ "$PM" == *"apt"* ]]; then
PM="apt"
apt-get update
apt-get upgrade -y
exit 0
elif [[ "$PM" == "yum" ]]; then
PM="yum"
yum check-update
yum update -y
exit 0
else
exit 1
fi
else
exit 1
fi
File copied to tmp:
#cp /root/LUM/lum.sh /var/tmp/
OK
However, trying to execute from tmp gives the same "not found" error:
#/var/tmp/lum.sh SCAN
sh: 1: /var/tmp/lum.sh: not found
I'm guess the problem is not that the file exists but that it simply doesn't want to execute due to some other weird system issue, but the error message is misleading. To my knowledge we don't have any special security software on this device, but it was something of a custom build so I'll check with the guy that deployed it to see if he might have any insight.