Created
May 20, 2016 21:09
-
-
Save cwgem/990a92fd94debe77021917d60b86d69a to your computer and use it in GitHub Desktop.
Running something in chroot with a specific user (inside the root)
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
| 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