From 895886f7a3daef704dbef94eac67234a7ccab5b3 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Fri, 29 Apr 2011 13:22:41 -0700 Subject: [PATCH] cd to home directory before running shell --- ajaxterm/index.cgi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ajaxterm/index.cgi b/ajaxterm/index.cgi index 478355c1c..bc3ffd8f8 100755 --- a/ajaxterm/index.cgi +++ b/ajaxterm/index.cgi @@ -38,6 +38,9 @@ if (!$pid) { untie(*STDERR); open(STDERR, ">$logfile"); $shell = &has_command("bash") || &has_command("sh") || "/bin/sh"; + @uinfo = getpwnam("root"); + $home = $uinfo[7] || "/"; + $shell = "$shell -c ".quotemeta("cd '$home' ; exec $shell"); exec($python, "ajaxterm.py", "--port", $port, "--log", $config{'autologin'} ? ("--command", $shell) : ( )); exit(1);