Commit 68081b4a authored by Robert Ricci's avatar Robert Ricci

Restore old UID after doing the ssh, so that other scripts that might get

run (namely, power) see the user's UID rather than root's.
parent f856c39c
...@@ -278,7 +278,12 @@ sub RebootNode { ...@@ -278,7 +278,12 @@ sub RebootNode {
# #
print STDERR "Trying ssh reboot of $pc ...\n" if $debug; print STDERR "Trying ssh reboot of $pc ...\n" if $debug;
# Must change our real UID to root so that ssh will work. #
# Must change our real UID to root so that ssh will work. We save the old
# UID so that we can restore it after we finish the ssh
#
my $oldUID = $UID;
print STDERR "Saved UID: $oldUID\n" if $debug;
$UID = 0; $UID = 0;
# #
...@@ -320,6 +325,13 @@ sub RebootNode { ...@@ -320,6 +325,13 @@ sub RebootNode {
exit(0); exit(0);
} }
#
# Restore the old UID so that scripts run from this point on get the
# user's real UID
#
$UID = $oldUID;
print STDERR "Restored UID: $UID\n" if $debug;
# #
# Okay, before we power cycle lets really make sure. We wait a while # Okay, before we power cycle lets really make sure. We wait a while
# for it to stop responding to pings, and if it never goes silent, # for it to stop responding to pings, and if it never goes silent,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment