Last active
May 20, 2022 17:21
-
-
Save ruario/a05b24182419639900378c655b052890 to your computer and use it in GitHub Desktop.
A bourne shell function to check for the presence of user namespace support in the linux kernel by calling the unshare command to set one up
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
check-user-namespace () { | |
if ! command -v unshare >/dev/null 2>&1; then | |
echo "The unshare command is not available. Install the util-linux package to fix this." >&2 | |
return 2 | |
fi | |
if unshare -U true >/dev/null 2>&1; then | |
echo "User namespace support enabled" | |
return 0 | |
else | |
echo "User namespace support not enabled" | |
return 1 | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment