Skip to main content
13 votes

tramp and sudo: how to edit files under another account

To ssh in as you, and then run sudo su oracle, and then edit a file, do this: /ssh:you@remotehost|sudo:oracle@remotehost:/path/to/file
Bryan Murdock's user avatar
13 votes

Tramp mode is much slower than using terminal to ssh

I have also found the solutions on the tramp FAQ that address speeding tramp up to work pretty well. From the page, here is what I added to my configuration: (setq remote-file-name-inhibit-cache nil)...
colelemonz's user avatar
11 votes

Tramp: Waiting for prompts from remote shell

I had this exact same problem but it had nothing to do with RVM on ( which I also have ) on my Ubuntu-16.10 machine. It was related to by custom prompt (PS1) The issue was the prompt PS1. This fix :...
Jimi 's user avatar
  • 111
11 votes

Tramp unable to open some files

I had a similar problem when trying to open/save plain ASCII files via tramp's sftp: the files were fine, I was able to edit them with, for example,nano, but trying to open them via tramp would get ...
fr_andres's user avatar
  • 211
9 votes

How to debug hanging tramp connections?

I had it hang because it couldn't detect the shell prompt, I added this to my .zshenv file.. # Fix for TRAMP [ $TERM = "dumb" ] && unsetopt zle && PS1='$ ' Alternatively you can ...
Darius's user avatar
  • 191
8 votes

equivalent of unix "which" for exec-path?

You can attempt locating an executable in exec-path with executable-find: (executable-find "ls") ;=> "/usr/bin/ls" (executable-find "sl") ;=> nil
wasamasa's user avatar
  • 22.4k
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:...
Michael Albinus's user avatar
8 votes
Accepted

does tramp mode look at .dir-locals

enable-remote-dir-locals is a variable defined in ‘files.el’. Its value is nil You can customize this variable. This variable was introduced, or its default value was changed, in version 24.3 of ...
phils's user avatar
  • 53k
7 votes

TRAMP is unbearably slow (OSX, ssh)

I know it's an old question and that you maybe don't care about the answer now but I do faced the same issue. I was pretty sure it was OS X related but in fact lags and timeouts were caused by my ...
Bounga's user avatar
  • 91
7 votes

cant connect with TRAMP (tramp-file-name-handler: Couldn’t find local shell prompt for /bin/sh)

Your remote prompt is not Tramp compatible. Check the Tramp documentation how to simplify it. Something like this might work: [ $TERM = "dumb" ] && PS1='$ ' If your remote shell is zsh, you ...
Michael Albinus's user avatar
6 votes

Can Emacs use tramp to run in an interactive session on a remote HPC node?

I have been struggling to do the same. I found a different route that allowed me to do basically the same thing. You can open a shell buffer by M-x shell and from there connect to the login node, and ...
Joonha Park's user avatar
6 votes

Running ipython remotely

@serv-inc answear is the best approach here: (setq python-shell-interpreter "ssh yourhost ipython" python-shell-interpreter-args "--simple-prompt -i") but it will still fail with the error:...
atevm's user avatar
  • 958
6 votes
Accepted

Magit doesn't recognise git repo through ssh connection

Error (magit): Magit requires Git >= 1.9.4, you are using 1.8.3. I've already installed git 2.10.0 on /usr/local/git The list of directories to search for executables on remote hosts is ...
tarsius's user avatar
  • 26.3k
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-...
stardiviner's user avatar
  • 1,958
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-...
stardiviner's user avatar
  • 1,958
6 votes
Accepted

How can emacs org-mode execute shell code remotely as sudo?

Use TRAMP multi-hop syntax for :dir header. 4.4 Combining ssh or plink with su or sudo If the su or sudo option shall be performed on another host, it could be comnbined with a leading ssh or ...
Melioratus's user avatar
  • 4,758
6 votes
Accepted

Emacs find-file over SSH is too slow to connect

Indeed, Tramp doesn't like your fancy prompt. The Tramp manual explains what to do, the FAQ section. In short, you shall add to your remote .profile [[ $TERM == "dumb" ]] &&...
Michael Albinus's user avatar
5 votes
Accepted

How to execute emacs commands in background

No, there is no silver bullet. Magit, and I am sure Tramp, do run some child processes like git and scp asynchronously in some cases and in other cases they do not. The author has to decide on a case-...
tarsius's user avatar
  • 26.3k
5 votes

What is the equivalent of /sudo:root@localhost:/ in windows?

For Tramp, this is not available. One would need to write a new package tramp-runas.el or tramp-elevate.el, which implements it. Since I'm not using MS Windows myself, it is unlikely that I'll ...
Michael Albinus's user avatar
5 votes
Accepted

How do you upgrade tramp?

There are regular Tramp releases at https://ftp.gnu.org/gnu/tramp/, the latest one is Tramp 2.3.3. This is roughly the same what Emacs 26.1 will bring. The Tramp manual describes also how to use git ...
Michael Albinus's user avatar
5 votes
Accepted

Run local command on remote file with TRAMP?

I've written the following snippet which (as far as I can tell) does what you're looking for from the point of view of the ! command. It does the following: Takes the files that would have operated ...
Mark's user avatar
  • 440
5 votes
Accepted

How can I diagnose which `git` magit is running?

If the value already is just "git" but TRAMP never-the-less doesn't use the correct executable, then consult the info node `(tramp)Remote programs'. Did you do that? It says: When remote ...
phils's user avatar
  • 53k
5 votes

tramp gcloud compute ssh not working

If you just run gcloud compute config-ssh in the terminal regular ssh tramp will find the instances that are accessible.
donnaworriaboutit's user avatar
5 votes
Accepted

tramp-default-method has no effect

With Tramp 2.3 / Emacs 26.1, Tramp's syntax has changed. It requires now the method name mandatory. If you want the shorter version of Tramp file names (without the method), you must change the syntax ...
Michael Albinus's user avatar
5 votes
Accepted

Chown with dired over Tramp, from Windows machine

The proper fix would be (if (and (memq system-type '(ms-dos windows-nt)) (not (file-remote-p default-directory))) (error "chgrp not supported on this system")) I've fixed this in the ...
Michael Albinus's user avatar
5 votes
Accepted

How to make TRAMP aware of VPNs?

The answer to any engineering question that starts with “Can I have…” is almost always yes. The real question is how much work it will take, and whether it is worth it. You haven’t said what operating ...
db48x's user avatar
  • 19.1k
5 votes

Tramp mode - Copying files

You can use dired-async-do-copy from emacs-async to Run ‘dired-do-copy’ asynchronously.
Tianshu Wang's user avatar
  • 1,829
5 votes
Accepted

How to tell tramp to not ask me about autosave on local directory?

From the Tramp manual: Per default, TRAMP asks for confirmation if a root-owned remote backup, auto-save or lock file has to be written to your local temporary directory. If you want to suppress this ...
Michael Albinus's user avatar
4 votes
Accepted

Directory tracking in remote shell buffer

Not the best solution, but certainly a working one: Use [dirtrack-mode]. The following preparations are needed: 1. On the remote machine: Make sure the prompt of the remote shell contains the path ...
halloleo's user avatar
  • 1,385
4 votes

TRAMP vs ssh to remote emacs

A third variant is to mount the remote directories via sshfs and access them via your local Emacs. This has the advantage that you don't have to reproduce your Emacs setup on the remote machine(s) ...
loris's user avatar
  • 315

Only top scored, non community-wiki answers of a minimum length are eligible