aboutsummaryrefslogtreecommitdiff
path: root/src/connection/sudo.lisp
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-03-19 10:42:16 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-03-19 18:55:47 -0700
commit03faea5bac3337a23d821078984c12bdbedeb022 (patch)
treed56799fd215e102e61323f43a8670dd67f5b56ed /src/connection/sudo.lisp
parentb79d04778cd98026370336dce955d668a5ef8395 (diff)
downloadconsfigurator-03faea5bac3337a23d821078984c12bdbedeb022.tar.gz
:SUDO connection type: reset the working directory
We want use of this connection type to be as close as possible to just SSHing in as root. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/connection/sudo.lisp')
-rw-r--r--src/connection/sudo.lisp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/connection/sudo.lisp b/src/connection/sudo.lisp
index 95d31fa..6612414 100644
--- a/src/connection/sudo.lisp
+++ b/src/connection/sudo.lisp
@@ -78,7 +78,8 @@
;; wrap in sh -c so that it is more likely we are either asked for a
;; password for all our commands or not asked for one for any
(format nil "sudo -HkS --prompt=\"\" --user=~A sh -c ~A"
- (slot-value connection 'user) (escape-sh-token cmd)))
+ (slot-value connection 'user)
+ (escape-sh-token (strcat "cd \"$HOME\"; " cmd))))
(defmethod connection-run ((c sudo-connection) cmd (input null))
(call-next-method c cmd (slot-value c 'password)))