Created
September 22, 2025 21:36
-
-
Save sandromello/4678dd2fbbb8f97adab80d15013cba1a to your computer and use it in GitHub Desktop.
Revisions
-
sandromello created this gist
Sep 22, 2025 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ #!/bin/bash set -eo pipefail LINUX_TARGET_USER= while IFS= read -r line; do [ -z "$line" ] && continue USER_EMAIL=$(echo -n $line | awk '{print $1}') if [ $USER_EMAIL == "$HOOP_USER_EMAIL" ]; then LINUX_USER=$(echo -n $line | awk '{print $2}') if [ -z ${LINUX_USER} ]; then echo "mapping not found for $USER_EMAIL!" exit 1 fi LINUX_TARGET_USER=$LINUX_USER echo "found linux user mapping for $USER_EMAIL -> $LINUX_USER!" break; fi done <<< "$USER_LIST" if [ -z "$LINUX_TARGET_USER" ]; then echo "unable to find valid mapping to login" exit 1 fi sudo su $LINUX_TARGET_USER