Created
August 23, 2023 15:11
-
-
Save mikroskeem/3ca24a2eed78d0b101842a1eabf6f97f to your computer and use it in GitHub Desktop.
Inspect systemd service namespace
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
#!/usr/bin/env bash | |
set -euo pipefail | |
svc="${1}" | |
pid="$(systemctl show --property MainPID --value "${svc}")" | |
user="$(systemctl show --property User --value "${svc}")" | |
uid="$(getent passwd "${user}" | cut -d: -f3)" | |
sudo nsenter -t "${pid}" -U -m -S "${uid}" /bin/bash -i |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment