8
votes
How to execute sudo command in org-babel in relative path under current working directory
You must use an absolute local directory path. Like this:
#+begin_src shell :dir "/sudo::/data/code/quirc" :cache no
make
sudo make install
#+end_src
See the leading slash in /data/code/quirc.
Edit:...
7
votes
Accepted
How to run sudo commands using shell-command?
When default-directory points to a sudo-ized path, shell-command uses this environment. Try
(let ((default-directory "/sudo::"))
(shell-command "ls"))
The password will be asked interactively.
7
votes
Edit file with super-user rights
If you use Helm. You don't need any external package / additional config. it works out of the box.
Inside helm-find-files you can invoke find file as root which bound to C-c r. This works for files ...
6
votes
Accepted
How to make Org-Babel support tangel to su/sudo file with tramp-sudo?
You can prefix tangle file path with /sudo::.
#+NAME: privoxy config for convert socks5 to HTTP proxy
#+BEGIN_SRC conf :tangle "/sudo::/etc/privoxy/config"
listen-address localhost:8118
forward-...
6
votes
Edit file with super-user rights
If you use the ivy package, and have configured counsel-find-file to replace find-file, then one of the "ivy actions" pre-configured for you already is to edit the file as root. The default hydra ...
6
votes
Accepted
How to execute sudo command in org-babel in relative path under current working directory
I suddenly come up with string concat idea.
Here is the very simple solution.
#+begin_src sh :dir (concat "/sudo::" (expand-file-name "data/code"))
pwd
#+end_src
#+RESULTS[(2020-...
4
votes
how to execute sudo su --login username command with TRAMP
The variable tramp-methods keeps the arguments which Tramp uses for different methods. For sudo, there is the entry
`("sudo"
(tramp-login-program "env")
(tramp-login-...
4
votes
Can I acquire root privilege to edit a system file without restarting emacs with `sudo`?
With a Tramp method:
C-x C-f /sudo::/your/system/file/here
That is just add the prefix "/sudo::" before your file and Emacs will ask you your sudo password. :-)
3
votes
Accepted
Sudo caching on compilation mode
I suppose you are using Tramp's sudo method to run the command with root permissions from Emacs. With a very recent snapshot of Tramp 2.4.1-pre (or 27.0.50), there is a new configuration parameter to ...
2
votes
Circumvent sudo fingerprint in tramp
Sudo doesn't give the calling user much control over authentication methods. But you can get some control through the PAM stack. One way to solve your problem would be to have sudo detect when it's ...
2
votes
Accepted
How to overwrite protected files in dired
I can reproduce the problem with Emacs 28.3 / Tramp 2.5.4-pre. Running the very same recipe with Emacs 29.0.90 / Tramp 2.6.0.29.1 works as expected.
Emacs 29.1 is in pretest. So I recommend for the ...
2
votes
Accepted
How to avoid using auth-sources when editing with sudo?
This is the same question as discussed in https://debbugs.gnu.org/46674
In short: Use Tramp 2.5 from GNU ELPA, and apply in your .emacs
(connection-local-set-profile-variables
'remote-without-auth-...
2
votes
Can I acquire root privilege to edit a system file without restarting emacs with `sudo`?
You should checkout this page of DOOM. There is a function which does this:
(defun doom/sudo-find-file (file)
"Open FILE as root."
(interactive
(list (read-file-name "Open as root: ")))
(...
1
vote
How can I change TRAMP sudo password timeout?
TRAMP only asks for the password when sudo requires it to ask. If you want to configure how sudo works, then read the manual page for sudo.
1
vote
Emacs, .historian and root user
This is the solution I use to edit files as root using a single running emacs daemon:
export EDITOR="emacsclient --tty --create-frame"
alias e="$EDITOR"
alias E=sudoedit
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
sudo × 31tramp × 18
root × 6
dired × 5
ssh × 3
org-babel × 2
shell-command × 2
org-mode × 1
key-bindings × 1
emacsclient × 1
files × 1
eshell × 1
gnus × 1
doom × 1
linux × 1
ido × 1
emacs-daemon × 1
install × 1
compilation-mode × 1
auto-save × 1
gpg × 1
async × 1
passwords × 1
permissions × 1
authinfo × 1