5

I constantly use /sudo::/ URI schema on Linux to edit protected files.

Is there something similar on Windows?

Currently I start Emacs with Administrator privileges but that can lead to write protected files with some directory permissions' inheritance schemas.

gavenkoa
  • 3,352
  • 19
  • 36
  • In principle, if Tramp doesn't do it, you can add your own method (see example here: https://www.emacswiki.org/emacs/TrampAndDocker ), and then call `elevate` (see discussion here: https://superuser.com/a/269750/152534 ) to make it work. – wvxvw Aug 30 '17 at 17:55

1 Answers1

0

Windows attaches security token to an app which cannot be changes unless you spawn another process. So sudo-like functionality makes sense. But Windows security is a bit complicated - not for user consumption ))

To edit c:/Windows/system32/drivers/etc/hosts you need to be an administrator + firewalls / antivirus might "lock" the file + some paths are secured non-standard.

So I just start Emacs elevated instead so I don't need sudo (utilizing Cygwin, run is for hiding a Conhost terminal window):

cygstart --action=runas run emacs-w32

Source code: https://hg.defun.work/utils/file/tip/emacs/re.bat

gavenkoa
  • 3,352
  • 19
  • 36