|Subject:||Would like to have tramp pass sudo arg|
|Date:||Fri, 31 Aug 2018 14:31:33 +0000|
I have the following code, which works well to a point:
(defun sudo-shell-as-user (host user &optional arg)
"Use sudo to open a shell on HOST as USER
The password it asks for is the root password on the specified machine."
(interactive "sMachine? \nsUser? ")
(arg (if arg arg 1))
(newone (if (not (string-match "/sudo:" default-directory)) t nil))
(default-directory (if newone (concat "/sudo:" user "@" host ":") default-directory)))
(setq bname (concat "*ssh-sudo:" user "@" host "*<" (number-to-string arg) ">"))
(if (string-match dir ".") (setq dir "~"))
(insert (concat "cd " dir))
This lets me log in as the user using sudo to the specified computer.
But I don't have that that user's environment. I *think* what I need is the option "-i" or "--login" to the command sudo. But I can't figure how to get it in there.
Is this possible? Is this what I even need?
Any input appreciated.
|[Prev in Thread]||Current Thread||[Next in Thread]|