Skip to content

Instantly share code, notes, and snippets.

(defun find-file-as-root ()
"Find a file as root."
(interactive)
(let* ((parsed (when (tramp-tramp-file-p default-directory)
(coerce (tramp-dissect-file-name default-directory)
'list)))
(default-directory
(if parsed
(apply 'tramp-make-tramp-file-name
(append '("sudo" "root") (cddr parsed)))