I've recently started learning to use Emacs.
I do not want to run emacs using sudo emacs
(lets not ask why), so I tried using pkexec to start emacs with root privileges. However, pkexec emacs
starts emacs in terminal mode. How can I solve this?
Or is there any other alternative where I can possibly use emacs to edit files with root
privileges.
This is the custom policy:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
"-//freedesktop//DTD polkit Policy Configuration 1.0//EN"
"https://www.freedesktop.org/software/polkit/policyconfig-1.dtd">
<policyconfig>
<action id="com.ubuntu.pkexec.emacs">
<description>Run Emacs with root privileges</description>
<message>
Authentication is required to run Emacs with root privileges
</message>
<icon_name>Emacs</icon_name>
<defaults>
<allow_any>auth_admin</allow_any>
<allow_inactive>auth_admin</allow_inactive>
<allow_active>>auth_admin</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/emacs</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
</policyconfig>
Note:
- A similar policy for
brackets
works fine. - Emacs starts in GUI mode if I use either
emacs
orsudo emacs
in terminal.
Any help is appreciated.
Emacs version 24.5.1 in ubuntu 16.10
tramp
emacswiki.org/emacs/TrampMode . For example try opening the file at path://sudo:root@localhost:/etc/group
sudo
also have a look here: emacsredux.com/blog/2013/04/21/edit-files-as-root