Skip to content

Instantly share code, notes, and snippets.

@stephen-hannam
Created October 19, 2021 19:32
Show Gist options
  • Save stephen-hannam/1d6ae9544ec9acf2fedb67e087b9efac to your computer and use it in GitHub Desktop.
Save stephen-hannam/1d6ae9544ec9acf2fedb67e087b9efac to your computer and use it in GitHub Desktop.
Procedural Privilege Escalation (as seen in LFS)

Procedural Privilege Escalation (from LFS scripts)

as_root()
{
  if   [ $EUID = 0 ];        then $*
  elif [ -x /usr/bin/sudo ]; then sudo $*
  else                            su -c \\"$*\\"
  fi
}

export -f as_root
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment