Check if /etc/subgid and /etc/subuid have entries for the user

This is relevant when running on hosts where the current user might
have been created long ago with an old version of shadow-utils, and
the host OS has been upgraded in-place ever since.

https://github.com/debarshiray/toolbox/issues/174
This commit is contained in:
Debarshi Ray 2019-05-24 13:30:47 +02:00
parent 9215c6f549
commit 0886fb466e

View file

@ -1661,6 +1661,15 @@ if [ -f /run/.containerenv ] 2>&3; then
exit 1
fi
else
echo "$base_toolbox_command: checking if /etc/subgid and /etc/subuid have entries for user $USER" >&3
if ! grep "$USER" /etc/subgid >/dev/null 2>&3 || ! grep "$USER" /etc/subuid >/dev/null 2>&3; then
echo "$base_toolbox_command: /etc/subgid and /etc/subuid don't have entries for user $USER" >&2
echo "See the podman(1), subgid(5), subuid(5) and usermod(8) manuals for more" >&2
echo "information." >&2
exit 1
fi
if [ "$TOOLBOX_PATH" = "" ] 2>&3; then
TOOLBOX_PATH="$toolbox_command_path"
fi