Sometimes, when I am running an emacs process (either started withemacs -nw
or emacsclient -nw
with an emacs server daemon), I would like to edit a system file. Can I acquire root privilege without restarting emacs with sudo
?
If I am using an emacs process started with emacsclient -nw
, do I need to restart the emacs server process with sudo
, i.e. sudo emacs --daemon
?
Without restarting emacs server with sudo
, is it possible to start emacs client with sudo
? I can't find a solution:
$ ps aux | grep emacs
t 3235 0.0 0.3 398732 24904 ? Ssl Mar31 0:00 emacs --daemon
$ sudo emacsclient -nw /etc/profile
[sudo] password for t:
emacsclient: can't find socket; have you started the server?
To start the server in Emacs, type "M-x server-start".
emacsclient: No socket or alternate editor. Please use:
--socket-name
--server-file (or environment variable EMACS_SERVER_FILE)
--alternate-editor (or environment variable ALTERNATE_EDITOR)
/sudo::filename
or/su::filename
.