Merge branch 'dev' of feistymeow.org:feisty_meow into release-2.140.94
[feisty_meow.git] / infobase / examples / os_related / user_sudoing.sh
diff --git a/infobase/examples/os_related/user_sudoing.sh b/infobase/examples/os_related/user_sudoing.sh
new file mode 100644 (file)
index 0000000..4f12ed7
--- /dev/null
@@ -0,0 +1,13 @@
+
+# if this script is run as sudo, then at some point it may be useful to become another
+# user, in order to run something from within their context.  this is one way to do it
+# with a semi-interactive set of steps...
+sudo -u chronical bash <<eof
+echo hello this is \$USER
+echo we be in \$(pwd)
+echo "where you at?"
+eof
+
+# this can also be done by running a script with all those commands in it.
+sudo -u chronical bash /home/chronical/thing_to_run_as_chronical.sh
+