Skip to content

Instantly share code, notes, and snippets.

@cwgem
Created May 20, 2016 21:09
Show Gist options
  • Select an option

  • Save cwgem/990a92fd94debe77021917d60b86d69a to your computer and use it in GitHub Desktop.

Select an option

Save cwgem/990a92fd94debe77021917d60b86d69a to your computer and use it in GitHub Desktop.
Running something in chroot with a specific user (inside the root)
user_chroot() {
local user=$1; shift;
local mount_point=$2; shift;
chroot "${mount_point}" /bin/su - "${user}" -c "$*"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment