From ab4bcae1d9e91303863c7a389b68b69c44d8d6fe Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Wed, 12 Dec 2012 01:10:38 +0100 Subject: [PATCH] Properly drop back into a su'ed command --- logshell/logcmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logshell/logcmd b/logshell/logcmd index 1365378..eac60f1 100755 --- a/logshell/logcmd +++ b/logshell/logcmd @@ -16,7 +16,7 @@ logfile = open("/etc/cvm/log/log.%s" % rand, "w") logfile.write("# NON-INTERACTIVE COMMAND EXECUTION\n") logfile.write("$ " + command + "\n") -prc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) +prc = subprocess.Popen(["su", "-s", "/bin/bash", "-c", command, "cvm"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) while prc.poll() is None: stdout = prc.stdout.read()