Fix console with a user

Sorry, boys, but do you even *minimally* test your changes?
This commit is contained in:
Pietro Cerutti
2025-05-06 09:33:54 +02:00
committed by GitHub
parent bd0d177150
commit acf2f08f5d

View File

@@ -92,18 +92,18 @@ validate_user() {
local _user="${2}"
if jexec -l "${_jail}" id "${_user}" >/dev/null 2>&1; then
USER_SHELL="$(jexec -l "${_jail}" getent passwd "${_user}}" | cut -d: -f7)"
USER_SHELL="$(jexec -l "${_jail}" getent passwd "${_user}" | cut -d: -f7)"
if [ -n "${USER_SHELL}" ]; then
if jexec -l "${_jail}" grep -qwF "${USER_SHELL}" /etc/shells; then
jexec -l "${_jail}" $LOGIN -f "${_user}}"
jexec -l "${_jail}" $LOGIN -f "${_user}"
else
echo "Invalid shell for user ${_user}}"
echo "Invalid shell for user ${_user}"
fi
else
echo "User ${_user}} has no shell"
echo "User ${_user} has no shell"
fi
else
echo "Unknown user ${_user}}"
echo "Unknown user ${_user}"
fi
}
@@ -143,4 +143,4 @@ for _jail in ${JAILS}; do
${_setfib} jexec -l "${_jail}" $LOGIN -f root
fi
done
done