gergelypolonkai-web-jekyll/_posts/2016-11-10-edit-file-as-oth...

968 B
Raw Blame History

layout title date tags published author
post Edit file as another user in Emacs 2016-11-10 08:57:12
development
emacs
true
name email
Gergely Polonkai gergely@polonkai.eu

I have recently found this article by Bozhidar Batsov on opening the current file as root. I barely use tramp for sudo access, but when I do, I almost never use root as the target user. So I decided to fix it for my needs.

{% gist 192c83aa0556d5cdaf4018f57b75a84b %}

If the user is not specified, the default is still root. Also, if the current buffer is not visiting a file, I prompt for a filename. As Im not an ido user, I didnt bother calling ido-read-file-name; helm overrides read-file-name for me anyway.

Unlike Bozhidar, I barely use this feature, so I didnt bind this to a key.