Last active
March 20, 2019 21:29
-
-
Save facelordgists/fffa7760657be496da0ace5ce95e207e to your computer and use it in GitHub Desktop.
how to run a script or command as a different user in the terminal who doesn't have a login (nginx and www-data are common examples).
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
# run as nginx | |
su nginx -s /bin/bash -c "php -f script.php" | |
su nginx -s /bin/bash -c '/path/to/your/script' | |
# run as testuser | |
su -s /bin/bash -c '/path/to/your/script' testuser |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment