Skip to content

Instantly share code, notes, and snippets.

@richarddewit
Created September 16, 2020 08:08
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save richarddewit/45629d12cfb7f8402a327f879f598662 to your computer and use it in GitHub Desktop.
A `su` replacement using machinectl
#!/usr/bin/env bash
if [[ "$1" == "-" ]]; then
shift
fi
if [ -z "$1" ]; then
echo "Missing argument USER"
exit 1
fi
machinectl shell --uid=$(id -u "$1")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment