TRAMP 2.5.3.28.2 User Manual
This file documents TRAMP 2.5.3.28.2, a remote file editing package for Emacs.
TRAMP stands for “Transparent Remote (file) Access, Multiple Protocol”. This package provides remote file editing, similar to Ange FTP.
The difference is that Ange FTP uses FTP to transfer files between the
local and the remote host, whereas TRAMP uses a combination of
rsh
and rcp
or other work-alike programs, such as
ssh
/scp
.
You can find the latest version of this document on the web at https://www.gnu.org/software/tramp/.
The latest release of TRAMP is available for download, or you may see Obtaining TRAMP for more details, including the Git server details.
TRAMP also has a Savannah Project Page.
There is a mailing list for TRAMP, available at tramp-devel@gnu.org, and archived at the TRAMP Mail Archive.
Copyright © 1999–2022 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with the Front-Cover Texts being “A GNU Manual”, and with the Back-Cover Texts as in (a) below. A copy of the license is included in the section entitled “GNU Free Documentation License”.
(a) The FSF’s Back-Cover Text is: “You have the freedom to copy and modify this GNU manual.”
Table of Contents
- 1 An overview of TRAMP
- 2 Obtaining TRAMP
- 3 Short introduction how to use TRAMP
- 4 Configuring TRAMP
- 4.1 Types of connections to remote hosts
- 4.2 Inline methods
- 4.3 External methods
- 4.4 GVFS-based external methods
- 4.5 FUSE-based external methods
- 4.6 Selecting a default method
- 4.7 Selecting a default user
- 4.8 Selecting a default host
- 4.9 Connecting to a remote host using multiple hops
- 4.10 Passing firewalls
- 4.11 Using Non-Standard Methods
- 4.12 Selecting config files for user/host name completion
- 4.13 Reusing passwords for several connections
- 4.14 Reusing connection related information
- 4.15 Setting own connection related information
- 4.16 How TRAMP finds and uses programs on the remote host
- 4.17 Remote shell setup hints
- 4.18 FUSE setup hints
- 4.19 Android shell setup hints
- 4.20 Auto-save, File Lock and Backup configuration
- 4.21 Protect remote files by encryption
- 4.22 Issues with Cygwin ssh
- 5 Using TRAMP
- 5.1 TRAMP file name conventions
- 5.2 Alternative file name syntax
- 5.3 File name completion
- 5.4 Declaring multiple hops in the file name
- 5.5 Integration with other Emacs packages
- 5.5.1 Running remote programs that create local X11 windows
- 5.5.2 Running
shell
on a remote host - 5.5.3 Running
shell-command
on a remote host - 5.5.4 Running
eshell
on a remote host - 5.5.5 Running a debugger on a remote host
- 5.5.6 Running remote processes on MS Windows hosts
- 5.5.7 Remote process connection type
- 5.5.8 Improving performance of asynchronous remote processes
- 5.6 Cleanup remote connections
- 5.7 Renaming remote files
- 5.8 Archive file names
- 6 Reporting Bugs and Problems
- 7 Frequently Asked Questions
- 8 How file names, directories and localnames are mangled and managed
- 9 How to Customize Traces
- Appendix A GNU Free Documentation License
- Function Index
- Variable Index
- Concept Index
Next: Obtaining TRAMP, Up: TRAMP 2.5.3.28.2 User Manual [Contents][Index]
1 An overview of TRAMP
TRAMP is for transparently accessing remote files from within
Emacs. TRAMP enables an easy, convenient, and consistent
interface to remote files as if they are local files. TRAMP’s
transparency extends to editing, version control, and dired
.
TRAMP can access remote hosts using any number of access
methods, such as rsh
, rlogin
, telnet
,
and related programs. If these programs can successfully pass
ASCII characters, TRAMP can use them.
TRAMP does not require or mandate 8-bit clean connections.
TRAMP’s most common access method is through ssh
, a
more secure alternative to ftp
and other older access
methods.
TRAMP on MS Windows operating systems is integrated with the
PuTTY package, and uses the plink
program.
TRAMP mostly operates transparently in the background using the connection programs. As long as these programs enable remote login and can use the terminal, TRAMP can adapt them for seamless and transparent access.
TRAMP temporarily transfers a remote file’s contents to the local host editing and related operations. TRAMP can also transfer files between hosts using standard Emacs interfaces, a benefit of direct integration of TRAMP in Emacs.
TRAMP can transfer files using any number of available host
programs for remote files, such as rcp
, scp
,
rsync
or (under MS Windows) pscp
. TRAMP
provides easy ways to specify these programs and customize them to
specific files, hosts, or access methods.
For faster small-size file transfers, TRAMP supports encoded
transfers directly through the shell using mimencode
or
uuencode
provided such tools are available on the remote
host.
TRAMP behind the scenes
Accessing a remote file through TRAMP entails a series of actions, many of which are transparent to the user. Yet some actions may require user response (such as entering passwords or completing file names). One typical scenario, opening a file on a remote host, is presented here to illustrate the steps involved:
C-x C-f to initiate find-file, enter part of the TRAMP file name, then hit TAB for completion. If this is the first time connecting to that host, here’s what happens:
sbin/ | scp: | scpx: | sftp: | sg: |
smb: | srv/ | ssh: | sshx: | su: |
sudo: | sys/ |
‘ssh:’ is a possible completion for the respective method, and ‘sbin/’ stands for the directory /sbin on your local host.
Type s h : for the minibuffer completion to ‘/ssh:’. Typing TAB shows host names TRAMP extracts from ~/.ssh/config file, for example1.
ssh:127.0.0.1: | ssh:192.168.0.1: |
ssh:[::1]: | ssh:localhost: |
ssh:melancholia.danann.net: | ssh:melancholia: |
Choose a host from the above list and then continue to complete file names on that host.
When the configuration (see Selecting config files for user/host name completion) includes user names, then the completion lists will account for the user names as well.
Results from auth-sources
search (see Using an authentication file) are added to the completion candidates. This
search could be annoying, for example due to a passphrase request of
the ~/.authinfo.gpg authentication file. The user option
tramp-completion-use-auth-sources
controls, whether such a
search is performed during completion.
Remote hosts previously visited or hosts whose connections are kept persistently (see Reusing connection related information) will be included in the completion lists.
After remote host name completion comes completion of file names on the remote host. It works the same as with local host file completion except that killing with double-slash // kills only the file name part of the TRAMP file name syntax. A triple-slash stands for the default behavior.
Example:
C-x C-f /ssh:melancholia:/usr/local/bin//etc TAB -| /ssh:melancholia:/etc C-x C-f /ssh:melancholia://etc TAB -| /ssh:melancholia:/etc C-x C-f /ssh:melancholia:/usr/local/bin///etc TAB -| /etc
Next: Integration with other Emacs packages, Previous: File name completion, Up: Using TRAMP [Contents][Index]
5.4 Declaring multiple hops in the file name
TRAMP file name syntax can accommodate ad-hoc specification of
multiple proxies without using tramp-default-proxies-alist
configuration setup (see Connecting to a remote host using multiple hops).
Each proxy is specified using the same syntax as the remote host specification minus the file name part. Each hop is separated by a ‘|’. Chain the proxies from the starting host to the destination remote host name and file name. For example, hopping over a single proxy ‘bird@bastion’ to a remote file on ‘you@remotehost’:
C-x C-f /ssh:bird@bastion|ssh:you@remotehost:/path RET
Each involved method must be an inline method (see Inline methods).
TRAMP adds the ad-hoc definitions on the fly to
tramp-default-proxies-alist
and is available for re-use during
that Emacs session. Subsequent TRAMP connections to the same
remote host can then use the shortcut form:
‘/ssh:you@remotehost:/path’. Ad-hoc definitions are
removed from tramp-default-proxies-alist
via the command
M-x tramp-cleanup-all-connections RET (see Cleanup remote connections).
- User Option: tramp-save-ad-hoc-proxies ¶
For ad-hoc definitions to be saved automatically in
tramp-default-proxies-alist
for future Emacs sessions, settramp-save-ad-hoc-proxies
to non-nil
.(customize-set-variable 'tramp-save-ad-hoc-proxies t)
Ad-hoc proxies can take patterns %h
or %u
like in
tramp-default-proxies-alist
. The following file name expands
to user ‘root’ on host ‘remotehost’, starting with an
ssh session on host ‘remotehost’:
‘/ssh:%h|su:remotehost:’.
On the other hand, if a trailing hop does not specify a host name, the host name of the previous hop is reused. Therefore, the following file name is equivalent to the previous example: ‘/ssh:remotehost|su::’.
Next: Cleanup remote connections, Previous: Declaring multiple hops in the file name, Up: Using TRAMP [Contents][Index]
5.5 Integration with other Emacs packages
TRAMP supports starting new running processes on the remote host for discovering remote file names. Emacs packages on the remote host need no specific modifications for TRAMP’s use.
This type of integration does not work with the ftp method,
and does not support the pty association as specified in
start-file-process
.
process-file
and start-file-process
work on the remote
host when the variable default-directory
is remote:
(let ((default-directory "/ssh:remote.host:")) (start-file-process "grep" (get-buffer-create "*grep*") "/bin/sh" "-c" "grep -e tramp *"))
For a local process, process-file
returns either the exit code
of the process, or a string describing a signal, when the process has
been interrupted. Since it cannot be determined reliably whether a
remote process has been interrupted, process-file
will always
returns the exit code for it. When the user option
process-file-return-signal-string
is non-nil
,
process-file
treats all exit codes greater than 128 as an
indication that the process has been interrupted, and returns a
corresponding string.
This remote process handling does not apply to GVFS (see
GVFS-based external methods) because the remote file system is mounted on
the local host and TRAMP accesses it by changing the
default-directory
.
TRAMP starts a remote process when a command is executed in a
remote file or directory buffer. As of now, these packages have been
integrated to work with TRAMP: shell.el,
eshell.el, compile.el (commands like compile
and
grep
) and gud.el (gdb
or perldb
).
TRAMP always modifies the INSIDE_EMACS
environment
variable for remote processes. By default, this environment variable
shows the Emacs version. TRAMP adds its own version string,
so it looks like ‘27.2,tramp:2.4.5.1’. However, other packages
might also add their name to this environment variable, like
‘27.2,comint,tramp:2.4.5.1’.
For TRAMP to find the command on the remote, it must be
accessible through the default search path as setup by TRAMP
upon first connection. Alternatively, use an absolute path or extend
tramp-remote-path
(see How TRAMP finds and uses programs on the remote host):
(add-to-list 'tramp-remote-path "~/bin") (add-to-list 'tramp-remote-path "/appli/pub/bin")
Customize user option tramp-remote-process-environment
to
suit the remote program’s environment for the remote host.
tramp-remote-process-environment
is a list of strings
structured similar to process-environment
, where each element
is a string of the form ‘ENVVARNAME=VALUE’.
To avoid any conflicts with local host environment variables set through local configuration files, such as ~/.profile, use ‘ENVVARNAME=’ to unset them for the remote environment.
Use add-to-list
to add entries:
(add-to-list 'tramp-remote-process-environment "JAVA_HOME=/opt/java")
Modifying or deleting already existing values in the
tramp-remote-process-environment
list may not be feasible on
restricted remote hosts. For example, some system administrators
disallow changing HISTORY
environment variable. To accommodate
such restrictions when using TRAMP, fix the
tramp-remote-process-environment
by the following code in the
local .emacs file:
(let ((process-environment tramp-remote-process-environment)) (setenv "HISTORY" nil) (setq tramp-remote-process-environment process-environment))
Setting the ENV
environment variable instructs some shells to
read an initialization file. By default, TRAMP disables
this. You can override this behavior by evaluating
(let ((process-environment tramp-remote-process-environment)) (setenv "ENV" "$HOME/.profile") (setq tramp-remote-process-environment process-environment))
In addition to tramp-remote-process-environment
, you can set
environment variables for individual remote process calls by
let-binding process-environment
. TRAMP applies any
entries not present in the global default value of
process-environment
(overriding
tramp-remote-process-environment
settings, if they conflict).
For example:
(let ((process-environment (cons "HGPLAIN=1" process-environment))) (process-file …))
Let-binding in this way works regardless of whether the process to be
called is local or remote, since TRAMP would add just the
HGPLAIN
setting and local processes would take whole value of
process-environment
along with the new value of HGPLAIN
.
For integrating other Emacs packages so TRAMP can execute remotely, please file a bug report. See Reporting Bugs and Problems.
- Running remote programs that create local X11 windows
- Running
shell
on a remote host - Running
shell-command
on a remote host - Running
eshell
on a remote host - Running a debugger on a remote host
- Running remote processes on MS Windows hosts
- Remote process connection type
- Improving performance of asynchronous remote processes
5.5.1 Running remote programs that create local X11 windows
To allow a remote program to create an X11 window on the local host,
set the DISPLAY
environment variable for the remote host as
follows in the local .emacs file:
(add-to-list 'tramp-remote-process-environment (format "DISPLAY=%s" (getenv "DISPLAY")))
(getenv "DISPLAY")
should return a recognizable name for the
local host that the remote host can redirect X11 window
interactions. If querying for a recognizable name is not possible for
whatever reason, then replace (getenv "DISPLAY")
with a
hard-coded, fixed name. Note that using :0
for X11 display name
here will not work as expected.
An alternate approach is specify ForwardX11 yes or ForwardX11Trusted yes in ~/.ssh/config on the local host.
5.5.2 Running shell
on a remote host
Set explicit-shell-file-name
to the appropriate shell name
when using TRAMP between two hosts with different operating
systems, such as ‘windows-nt’ and ‘gnu/linux’. This option
ensures the correct name of the remote shell program.
When explicit-shell-file-name
is equal to nil
, calling
shell
interactively will prompt for a shell name.
Starting with Emacs 26, you could use connection-local variables
for setting different values of explicit-shell-file-name
for
different remote hosts.
(connection-local-set-profile-variables 'remote-bash '((explicit-shell-file-name . "/bin/bash") (explicit-bash-args . ("-i"))))
(connection-local-set-profile-variables 'remote-ksh '((explicit-shell-file-name . "/bin/ksh") (explicit-ksh-args . ("-i"))))
(connection-local-set-profiles '(:application tramp :protocol "ssh" :machine "localhost") 'remote-bash)
(connection-local-set-profiles `(:application tramp :protocol "sudo" :user "root" :machine ,(system-name)) 'remote-ksh)
5.5.3 Running shell-command
on a remote host
shell-command
executes commands synchronously or asynchronously
on remote hosts and displays output in buffers on the local
host. Example:
C-x C-f /sudo:: RET M-& tail -f /var/log/syslog.log RET
tail
command outputs continuously to the local buffer whose
name is the value of the variable shell-command-buffer-name-async
.
M-x auto-revert-tail-mode RET runs similarly showing continuous output.
shell-command
uses the user option shell-file-name
and
the variable shell-command-switch
in order to determine which
shell to run. For remote hosts, their default values are
/bin/sh and -c, respectively (except for the
adb method, which uses /system/bin/sh). Like the
variables in the previous section, these variables can be changed via
connection-local variables.
If Emacs supports the user option async-shell-command-width
(since Emacs 27), TRAMP cares about its value for
asynchronous shell commands. It specifies the number of display
columns for command output. For synchronous shell commands, a similar
effect can be achieved by adding the environment variable
COLUMNS
to tramp-remote-process-environment
.
5.5.4 Running eshell
on a remote host
TRAMP is integrated into eshell.el, which enables
interactive eshell sessions on remote hosts at the command prompt.
You must add the module eshell-tramp
to
eshell-modules-list
. Here’s a sample interaction after opening
M-x eshell RET on a remote host:
~ $ cd /sudo::/etc RET /sudo:root@host:/etc $ hostname RET host /sudo:root@host:/etc $ id RET uid=0(root) gid=0(root) groups=0(root) /sudo:root@host:/etc $ find-file shadow RET #<buffer shadow> /sudo:root@host:/etc $
eshell
added custom su
and sudo
commands that set
the default directory correctly for the *eshell* buffer.
TRAMP silently updates tramp-default-proxies-alist
with an entry for this directory (see Connecting to a remote host using multiple hops):
~ $ cd /ssh:user@remotehost:/etc RET /ssh:user@remotehost:/etc $ find-file shadow RET File is not readable: /ssh:user@remotehost:/etc/shadow /ssh:user@remotehost:/etc $ sudo find-file shadow RET #<buffer shadow>
/ssh:user@remotehost:/etc $ su - RET /su:root@remotehost:/root $ id RET uid=0(root) gid=0(root) groups=0(root) /su:root@remotehost:/root $
5.5.5 Running a debugger on a remote host
gud.el provides a unified interface to symbolic
debuggers.
TRAMP can run debug on remote hosts by calling gdb
with a remote file name:
M-x gdb RET Run gdb (like this): gdb -i=mi /ssh:host:~/myprog RET
Since the remote gdb
and gdb-inferior
processes do not
belong to the same process group on the remote host, there will be a
warning, which can be ignored:
&"warning: GDB: Failed to set controlling terminal: Operation not permitted\n"
As consequence, there will be restrictions in I/O of the process to be debugged.
Relative file names are based on the remote default directory. When myprog.pl exists in /ssh:host:/home/user, valid calls include:
M-x perldb RET Run perldb (like this): perl -d myprog.pl RET
Just the local part of a remote file name, such as perl -d
/home/user/myprog.pl
, is not possible.
Arguments of the program to be debugged must be literal, can take relative or absolute paths, but not remote paths.
5.5.6 Running remote processes on MS Windows hosts
winexe
runs processes on a remote MS Windows host, and
TRAMP can use it for process-file
and
start-file-process
.
tramp-smb-winexe-program
specifies the local winexe
command. Powershell V2.0 on the remote host is required to run
processes triggered from TRAMP.
explicit-shell-file-name
and explicit-*-args
have to
be set properly so M-x shell RET can open a proper remote
shell on a MS Windows host. To open cmd
, set it as follows:
(setq explicit-shell-file-name "cmd" explicit-cmd-args '("/q"))
To open powershell
as a remote shell, use this:
(setq explicit-shell-file-name "powershell" explicit-powershell-args '("-file" "-"))
5.5.7 Remote process connection type
Asynchronous processes behave differently based on whether they use a
pseudo tty or not. This is controlled by the variable
process-connection-type
, which can be t
or pty
(use a pseudo tty), or nil
or pipe
(don’t use one).
TRAMP is based on running shells on the remote host, which
requires a pseudo tty. Therefore, it declares the variable
tramp-process-connection-type
, which carries this information
for remote processes. Its default value is t
, and there is no
need to change it. The name of the remote pseudo tty is returned by
the function process-tty-name
.
If a remote process, started by start-file-process
, should
not use a pseudo tty, this can be requested by setting
process-connection-type
to nil
or pipe
. There is
still a pseudo tty for the started process, but some terminal
properties are changed, like suppressing translation of carriage
return characters into newline.
The function make-process
allows controlling this explicitly by
using the :connection-type
keyword. If this keyword is not
used, the value of process-connection-type
is applied instead.
5.5.8 Improving performance of asynchronous remote processes
TRAMP’s implementation of make-process
and
start-file-process
requires a serious overhead for
initialization, every process invocation. This is needed for handling
interactive dialogues when connecting the remote host (like providing
a password), and initial environment setup.
Sometimes, this is not needed. Instead of starting a remote shell and
running the command afterwards, it is sufficient to run the command
directly. TRAMP supports this by an alternative
implementation of make-process
and start-file-process
.
This is triggered by the connection property
"direct-async-process", See Setting own connection related information,
which must be set to a non-nil
value. Example:
(add-to-list 'tramp-connection-properties (list (regexp-quote "/ssh:user@host:") "direct-async-process" t))
Using direct asynchronous processes in TRAMP is not possible, if the remote host is connected via multiple hops (see Connecting to a remote host using multiple hops). In this case, TRAMP falls back to its classical implementation.
Furthermore, this approach has the following limitations:
- It works only for connection methods defined in tramp-sh.el and tramp-adb.el.
- It does not support interactive user authentication. With
ssh-based methods, this can be avoided by using a password
agent like
ssh-agent
, using public key authentication, or using ControlMaster options. - It cannot be applied for ssh-based methods, which use the RemoteCommand option.
- It cannot be killed via
interrupt-process
. - It does not report the remote terminal name via
process-tty-name
. - It does not set process property
remote-pid
. - It does not use
tramp-remote-path
.
In order to gain even more performance, it is recommended to bind
tramp-verbose
to 0 when running make-process
or
start-file-process
. Furthermore, you might set
tramp-use-ssh-controlmaster-options
to nil
in order to
bypass TRAMP’s handling of the ControlMaster options,
and use your own settings in ~/.ssh/config.
Next: Renaming remote files, Previous: Integration with other Emacs packages, Up: Using TRAMP [Contents][Index]
5.6 Cleanup remote connections
TRAMP provides several ways to flush remote connections.
- Command: tramp-cleanup-connection vec &optional keep-debug keep-password ¶
This command flushes all connection related objects. vec is the internal representation of a remote connection. When called interactively, this command lists active remote connections in the minibuffer. Each connection is of the format /method:user@host:.
Flushing remote connections also cleans the password cache (see Reusing passwords for several connections), file cache, connection cache (see Reusing connection related information), and recentf cache. It also deletes session timers (see Setting own connection related information) and connection buffers.
If keep-debug is non-
nil
, the debug buffer is kept. A non-nil
keep-password preserves the password cache.
- Command: tramp-cleanup-this-connection ¶
Flushes the current buffer’s remote connection objects, the same as in
tramp-cleanup-connection
.
- Command: tramp-cleanup-all-connections ¶
Flushes all active remote connection objects, the same as in
tramp-cleanup-connection
. This command removes also ad-hoc proxy definitions (see Declaring multiple hops in the file name).
- Command: tramp-cleanup-all-buffers ¶
Just as for
tramp-cleanup-all-connections
, all remote connections and ad-hoc proxy definition are cleaned up in addition to killing all buffers related to remote connections.
Next: Archive file names, Previous: Cleanup remote connections, Up: Using TRAMP [Contents][Index]
5.7 Renaming remote files
Sometimes, it is desirable to safe file contents of buffers visiting a given remote host. This could happen for example, if the local host changes its network integration, and the remote host is not reachable anymore.
- Command: tramp-rename-files source target ¶
Replace in all buffers the visiting file name from source to target. source is a remote directory name, which could contain also a localname part. target is the directory name source is replaced with. Often, target is a remote directory name on another host, but it can also be a local directory name. If target has no local part, the local part from source is used.
If target is
nil
, it is selected according to the first match intramp-default-rename-alist
. If called interactively, this match is offered as initial value for selection.On all buffers, which have a
buffer-file-name
matching source, this name is modified by replacing source with target. This is applied by callingset-visited-file-name
. The newbuffer-file-name
is prompted for modification in the minibuffer. The buffers are marked modified, and must be saved explicitly.If user option
tramp-confirm-rename-file-names
isnil
, changing the file name happens without confirmation. This requires a matching entry intramp-default-rename-alist
.Remote buffers related to the remote connection identified by source, which are not visiting files, or which are visiting files not matching source, are not modified.
Interactively, target is selected from
tramp-default-rename-alist
without confirmation if the prefix argument is non-nil
.The remote connection identified by source is flushed by
tramp-cleanup-connection
.
- Command: tramp-rename-these-files target ¶
Replace visiting file names to target. The current buffer must be related to a remote connection. In all buffers, which are visiting a file with the same directory name, the buffer file name is changed.
Interactively, target is selected from
tramp-default-rename-alist
without confirmation if the prefix argument is non-nil
.
- User Option: tramp-default-rename-alist ¶
The default target for renaming remote buffer file names. This is an alist of cons cells
(source . target)
. The first matching item specifies the target to be applied for renaming buffer file names from source viatramp-rename-files
.source
is a regular expressions, which matches a remote file name.target
must be a directory name, which could be remote (including remote directories Tramp infers by default, such as ‘/method:user@host:’).target
can contain the patterns%m
,%u
or%h
, which are replaced by the method name, user name or host name ofsource
when callingtramp-rename-files
.source
could also be a Lisp form, which will be evaluated. The result must be a string ornil
, which is interpreted as a regular expression which always matches.Example entries:
("/ssh:badhost:/path/to/dir/" . "/ssh:goodhost:/path/to/another/dir/")
would trigger renaming of buffer file names on ‘badhost’ to ‘goodhost’, including changing the directory name.
("/ssh:.+\\.company\\.org:" . "/ssh:multi.hop|ssh:%h:")
routes all connections to a host in ‘company.org’ via ‘/ssh:multi.hop:’, which might be useful when using Emacs outside the company network.
(nil . "~/saved-files/%m:%u@%h/")
saves all remote files locally, with a directory name including method name, user name and host name of the remote connection.
- User Option: tramp-confirm-rename-file-names ¶
Whether renaming a buffer file name by
tramp-rename-files
ortramp-rename-these-files
must be confirmed.
Previous: Renaming remote files, Up: Using TRAMP [Contents][Index]
5.8 Archive file names
TRAMP offers also transparent access to files inside file archives. This is possible only on hosts which have installed GVFS (the GNOME Virtual File System), GVFS-based external methods. Internally, file archives are mounted via the GVFS archive method.
A file archive is a regular file of kind /path/to/dir/file.EXT. The extension ‘.EXT’ identifies the type of the file archive. To examine the contents of an archive with Dired, open file name as if it were a directory (i.e., open /path/to/dir/file.EXT/). A file inside a file archive, called archive file name, has the name /path/to/dir/file.EXT/dir/file.
Most of the (elisp)magic file name operations, are implemented for archive file names, exceptions are all operations which write into a file archive, and process related operations. Therefore, functions like
(copy-file "/path/to/dir/file.tar/dir/file" "/somewhere/else")
work out of the box. This is also true for file name completion, and
for libraries like dired
or ediff
, which accept archive
file names as well.
File archives are identified by the file name extension ‘.EXT’.
Since GVFS uses internally the library libarchive(3)
,
all suffixes, which are accepted by this library, work also for
archive file names. Accepted suffixes are listed in the constant
tramp-archive-suffixes
. They are
- ‘.7z’ — 7-Zip archives
- ‘.apk’ — Android package kits
- ‘.ar’ — UNIX archiver formats
- ‘.cab’, ‘.CAB’ — Microsoft Windows cabinets
- ‘.cpio’ — CPIO archives
- ‘.deb’ — Debian packages
- ‘.depot’ — HP-UX SD depots
- ‘.exe’ — Self extracting Microsoft Windows EXE files
- ‘.iso’ — ISO 9660 images
- ‘.jar’ — Java archives
- ‘.lzh’, ‘.LZH’ — Microsoft Windows compressed LHA archives
- ‘.msu’, ‘.MSU’ — Microsoft Windows Update packages
- ‘.mtree’ — BSD mtree format
- ‘.odb’, ‘.odf’, ‘.odg’, ‘.odp’, ‘.ods’, ‘.odt’ — OpenDocument formats
- ‘.pax’ — Posix archives
- ‘.rar’ — RAR archives
- ‘.rpm’ — Red Hat packages
- ‘.shar’ — Shell archives
- ‘.tar’, ‘.tbz’, ‘.tgz’, ‘.tlz’, ‘.txz’, ‘.tzst’ — (Compressed) tape archives
- ‘.warc’ — Web archives
- ‘.xar’ — macOS XAR archives
- ‘.xpi’ — XPInstall Mozilla addons
- ‘.xps’ — Open XML Paper Specification (OpenXPS) documents
- ‘.zip’, ‘.ZIP’ — ZIP archives
File archives could also be compressed, identified by an additional
compression suffix. Valid compression suffixes are listed in the
constant tramp-archive-compression-suffixes
. They are
‘.bz2’, ‘.gz’, ‘.lrz’, ‘.lz’, ‘.lz4’,
‘.lzma’, ‘.lzo’, ‘.uu’, ‘.xz’, ‘.Z’, and
‘.zst’. A valid archive file name would be
/path/to/dir/file.tar.gz/dir/file. Even several suffixes in a
row are possible, like /path/to/dir/file.tar.gz.uu/dir/file.
An archive file name could be a remote file name, as in
/ftp:anonymous@ftp.gnu.org:/gnu/tramp/tramp-2.4.5.tar.gz/INSTALL.
Since all file operations are mapped internally to GVFS
operations, remote file names supported by tramp-gvfs
perform
better, because no local copy of the file archive must be downloaded
first. For example, ‘/sftp:user@host:...’ performs better than
the similar ‘/scp:user@host:...’. See the constant
tramp-archive-all-gvfs-methods
for a complete list of
tramp-gvfs
supported method names.
If url-handler-mode
is enabled, archives could be visited via
URLs, like
https://ftp.gnu.org/gnu/tramp/tramp-2.4.5.tar.gz/INSTALL. This
allows complex file operations like
(progn (url-handler-mode 1) (ediff-directories "https://ftp.gnu.org/gnu/tramp/tramp-2.4.4.tar.gz/tramp-2.4.4" "https://ftp.gnu.org/gnu/tramp/tramp-2.4.5.tar.gz/tramp-2.4.5" ""))
It is even possible to access file archives in file archives, as
(progn (url-handler-mode 1) (find-file "https://ftp.debian.org/debian/pool/main/c/coreutils/coreutils_8.28-1_amd64.deb/control.tar.gz/control"))
In order to disable file archives, you could add the following form to your init file:
(customize-set-variable 'tramp-archive-enabled nil)
Next: Frequently Asked Questions, Previous: Using TRAMP, Up: TRAMP 2.5.3.28.2 User Manual [Contents][Index]
6 Reporting Bugs and Problems
TRAMP’s development team is actively engaged in solving bugs and problems and looks to feature requests and suggestions.
TRAMP’s mailing list is the place for more advice and information on working with TRAMP, solving problems, discussing, and general discussions about TRAMP.
TRAMP’s mailing list is moderated but even non-subscribers can post for moderator approval. Sometimes this approval step may take as long as 48 hours due to public holidays.
tramp-devel@gnu.org is the mailing list. Messages sent to this address go to all the subscribers. This is not the address to send subscription requests to.
To subscribe to the mailing list, visit: the TRAMP Mail Subscription Page.
Check if the bug or problem is already addressed in See Frequently Asked Questions.
Run M-x tramp-bug RET to generate a buffer with details of the system along with the details of the TRAMP installation. Please include these details with the bug report.
The bug report must describe in as excruciating detail as possible the steps required to reproduce the problem. These details must include the setup of the remote host and any special or unique conditions that exist.
Include a minimal test case that reproduces the problem. This will help the development team find the best solution and avoid unrelated detours.
To exclude cache-related problems, flush all caches before running the
test, Cleanup remote connections. Alternatively, and often
better for analysis, reproduce the problem in a clean Emacs session
started with emacs -Q
. Then, TRAMP does not load
the persistency file (see Reusing connection related information), and it does not use
passwords from auth-source.el (see Reusing passwords for several connections). The
latter does not happen for the sudoedit method, otherwise it
would be unusable.
If you use the GNU ELPA version of TRAMP, you must load it
explicitly, because emacs -Q
ignores installed ELPA
packages. Call (version number adapted)
$ emacs -Q -l ~/.emacs.d/elpa/tramp-2.4.5.1/tramp-autoloads
When including TRAMP’s messages in the bug report, increase the verbosity level to 6 (see Traces) in the ~/.emacs file before repeating steps to the bug. Include the contents of the *tramp/foo* and *debug tramp/foo* buffers with the bug report. Both buffers could contain non-ASCII characters which are relevant for analysis, append the buffers as attachments to the bug report. This is also needed in order to avoid line breaks during mail transfer.
If you send the message from Emacs, you are asked about to append these buffers to the bug report. If you use an external mail program, you must save these buffers to files, and append them with that mail program.
Note that a verbosity level greater than 6 is not necessary at this stage. Also note that a verbosity level of 6 or greater, the contents of files and directories will be included in the debug buffer. Passwords typed in TRAMP will never be included there.
Next: How file names, directories and localnames are mangled and managed, Previous: Reporting Bugs and Problems, Up: TRAMP 2.5.3.28.2 User Manual [Contents][Index]
7 Frequently Asked Questions
- What is the official name - “Tramp” or “TRAMP”?
The official name is “Tramp”. This is used in comments, docstrings, and everywhere speaking about TRAMP.
However, for historical reasons this is formatted as “@sc{Tramp}” in the TRAMP manual. So it looks different there.
- Where is the latest TRAMP?
TRAMP is available at the GNU URL:
https://ftp.gnu.org/gnu/tramp/
TRAMP’s GNU project page is located here:
- Which systems does it work on?
The package works successfully on Emacs 25, Emacs 26, Emacs 27, and Emacs 28.
While Unix and Unix-like systems are the primary remote targets, TRAMP has equal success connecting to other platforms, such as MS Windows 7/8/10.
- How to speed up TRAMP?
TRAMP does many things in the background, some of which depends on network speeds, response speeds of remote hosts, and authentication delays. During these operations, TRAMP’s responsiveness slows down. Some suggestions within the scope of TRAMP’s settings include:
Use an external method, such as scp, which are faster than internal methods.
Keep the file
tramp-persistency-file-name
, which is where TRAMP caches remote information about hosts and files. Caching is enabled by default. Don’t disable it.Set
remote-file-name-inhibit-cache
tonil
if remote files are not independently updated outside TRAMP’s control. That cache cleanup will be necessary if the remote directories or files are updated independent of TRAMP.Disable version control to avoid delays:
(setq vc-ignore-dir-regexp (format "\\(%s\\)\\|\\(%s\\)" vc-ignore-dir-regexp tramp-file-name-regexp))
If this is too radical, because you want to use version control remotely, trim
vc-handled-backends
to just those you care about, for example:(setq vc-handled-backends '(SVN Git))
Disable excessive traces. Set
tramp-verbose
to 3 or lower, default being 3. Increase trace levels temporarily when hunting for bugs. - TRAMP does not connect to the remote host
Three main reasons for why TRAMP does not connect to the remote host:
- - Unknown characters in the prompt
TRAMP needs a clean recognizable prompt on the remote host for accurate parsing. Shell prompts that contain escape sequences for coloring cause parsing problems. Remote shell setup hints for customizing prompt detection using regular expressions.
To check if the remote host’s prompt is being recognized, use this test: switch to TRAMP connection buffer *tramp/foo*, put the cursor at the top of the buffer, and then apply the following expression:
M-: (re-search-forward (concat tramp-shell-prompt-pattern "$")) RET
If the cursor has not moved to the prompt at the bottom of the buffer, then TRAMP has failed to recognize the prompt.
When using zsh on remote hosts, disable zsh line editor because zsh uses left-hand side and right-hand side prompts in parallel. Add the following line to ~/.zshrc:
[[ $TERM == "dumb" ]] && unsetopt zle && PS1='$ ' && return
This uses the default value of
tramp-terminal-type
, "dumb", as value of theTERM
environment variable. If you want to use another value forTERM
, changetramp-terminal-type
and this line accordingly.Alternatively, you could set the remote login shell explicitly. See Remote shell setup hints for discussion of this technique,
When using fish shell on remote hosts, disable fancy formatting by adding the following to ~/.config/fish/config.fish:
function fish_prompt if test $TERM = "dumb" echo "\$ " else … end end
When using WinSSHD on remote hosts, TRAMP does not recognize the strange prompt settings.
A similar problem exist with the iTerm2 shell integration, which sends proprietary escape codes when starting a shell. This can be suppressed by changing the respective integration snippet in your ~/.profile like this:
[ $TERM = "dumb" ] || \ test -e "${HOME}/.iterm2_shell_integration.bash" && \ source "${HOME}/.iterm2_shell_integration.bash"
And finally, bash’s readline should not use key bindings like ‘C-j’ to commands. Disable this in your ~/.inputrc:
$if term=dumb # Don't bind Control-J or it messes up TRAMP. $else "\C-j": next-history $endif
- - Echoed characters after login
TRAMP suppresses echos from remote hosts with the
stty -echo
command. But sometimes it is too late to suppress welcome messages from the remote host containing harmful control characters. Using sshx or scpx methods can avoid this problem because they allocate a pseudo tty. See Inline methods. - - TRAMP stops transferring strings longer than 500 characters
Set
tramp-chunksize
to 500 to get around this problem, which is related to faulty implementation ofprocess-send-string
on HP-UX, FreeBSD and Tru64 Unix systems. Consult the documentation fortramp-chunksize
to see when this is necessary.Set
file-precious-flag
tot
for files accessed by TRAMP so the file contents are checked using checksum by first saving to a temporary file.(add-hook 'find-file-hook (lambda () (when (file-remote-p default-directory) (set (make-local-variable 'file-precious-flag) t))))
- - Unknown characters in the prompt
- TRAMP fails in a chrooted environment
When connecting to a local host, TRAMP uses some internal optimizations. They fail when Emacs runs in a chrooted environment. In order to disable those optimizations, set user option
tramp-local-host-regexp
tonil
. - TRAMP does not recognize if a
ssh
session hangsssh
sessions on the local host hang when the network is down. TRAMP cannot safely detect such hangs. The network configuration forssh
can be configured to kill such hangs with the following command in the ~/.ssh/config:Host * ServerAliveInterval 5
- TRAMP does not use default
ssh
ControlPathTRAMP overwrites ControlPath settings when initiating
ssh
sessions. TRAMP does this to fend off a stall if a master session opened outside the Emacs session is no longer open. That is why TRAMP prompts for the password again even if there is anssh
already open.Some
ssh
versions support a ControlPersist option, which allows you to set the ControlPath provided the variabletramp-ssh-controlmaster-options
is customized as follows:(customize-set-variable 'tramp-ssh-controlmaster-options (concat "-o ControlPath=/tmp/ssh-ControlPath-%%r@%%h:%%p " "-o ControlMaster=auto -o ControlPersist=yes"))
Note how ‘%r’, ‘%h’ and ‘%p’ must be encoded as ‘%%r’, ‘%%h’ and ‘%%p’.
If the ~/.ssh/config file is configured appropriately for the above behavior, then any changes to
ssh
can be suppressed with thisnil
setting:(customize-set-variable 'tramp-use-ssh-controlmaster-options nil)
This should also be set to
nil
if you use the ProxyCommand or ProxyJump options in yourssh
configuration.On MS Windows,
tramp-use-ssh-controlmaster-options
is set tonil
by default, because the MS Windows and MSYS2 implementations ofOpenSSH
do not support this option properly. - On multi-hop connections, TRAMP does not use
ssh
ControlMasterIn order to use the ControlMaster option, TRAMP must check whether the
ssh
client supports this option. This is only possible on the local host, for the first hop. TRAMP does not use this option on proxy hosts.If you want to use this option also for the other hops, you must configure ~/.ssh/config on the proxy host:
Host * ControlMaster auto ControlPath tramp.%C ControlPersist no
Check the ‘ssh_config(5)’ man page whether these options are supported on your proxy host.
- Does TRAMP support SSH security keys?
Yes.
OpenSSH
has added support for FIDO hardware devices via special key types *-sk. TRAMP supports the additional handshaking messages for them. This requires at leastOpenSSH
8.2, and a FIDO U2F compatible security key, like yubikey, solokey, or nitrokey. - TRAMP does not connect to Samba or MS Windows hosts running
SMB1 connection protocol
Recent versions of
smbclient
do not support old connection protocols by default. In order to connect to such a host, add a respective option:(add-to-list 'tramp-smb-options "client min protocol=NT1")
Note that using a deprecated connection protocol raises security problems, you should do it only if absolutely necessary.
- File name completion does not work with TRAMP
ANSI escape sequences from the remote shell may cause errors in TRAMP’s parsing of remote buffers.
To test if this is the case, open a remote shell and check if the output of
ls
is in color.To disable ANSI escape sequences from the remote hosts, disable ‘--color=yes’ or ‘--color=auto’ in the remote host’s .bashrc or .profile. Turn this alias on and off to see if file name completion works.
- File name completion does not work in directories with large number of
files
This may be related to globbing, which is the use of shell’s ability to expand wild card specifications, such as ‘*.c’. For directories with large number of files, globbing might exceed the shell’s limit on length of command lines and hang. TRAMP uses globbing.
To test if globbing hangs, open a shell on the remote host and then run
ls -d * ..?* > /dev/null
.When testing, ensure the remote shell is the same shell (
/bin/sh
,ksh
orbash
), that TRAMP uses when connecting to that host. - How to get notified after TRAMP completes file transfers?
Make Emacs beep after reading from or writing to the remote host with the following code in ~/.emacs.
(defadvice tramp-handle-write-region (after tramp-write-beep-advice activate) "Make TRAMP beep after writing a file." (interactive) (beep))
(defadvice tramp-handle-do-copy-or-rename-file (after tramp-copy-beep-advice activate) "Make TRAMP beep after copying a file." (interactive) (beep))
(defadvice tramp-handle-insert-file-contents (after tramp-insert-beep-advice activate) "Make TRAMP beep after inserting a file." (interactive) (beep))
- How to get a Visual Warning when working with ‘root’ privileges?
Host indication in the mode line?
Install tramp-theme from GNU ELPA via Emacs’s Package Manager. Enable it via M-x load-theme RET tramp RET. Further customization is explained in user option
tramp-theme-face-remapping-alist
. - Remote host does not understand default options for directory listing
Emacs computes the
dired
options based on the local host but if the remote host cannot understand the samels
command, then set them with a hook as follows:(add-hook 'dired-before-readin-hook (lambda () (when (file-remote-p default-directory) (setq dired-actual-switches "-al"))))
- Why is ~/.sh_history on the remote host growing?
Due to the remote shell saving tilde expansions triggered by TRAMP, the history file is probably growing rapidly. TRAMP can suppress this behavior with the user option
tramp-histfile-override
. When set tot
, environment variableHISTFILE
is unset, and environment variablesHISTFILESIZE
andHISTSIZE
are set to 0. Don’t use this withbash
5.0.0. There is a bug inbash
which letsbash
die.Alternatively,
tramp-histfile-override
could be a string. Environment variableHISTFILE
is set to this file name then. Be careful when setting to /dev/null; this might result in undesired results when usingbash
as remote shell.Another approach is to disable TRAMP’s handling of the
HISTFILE
at all by settingtramp-histfile-override
tonil
. In this case, saving history could be turned off by putting this shell code in .bashrc or .kshrc:if [ -f $HOME/.sh_history ] ; then /bin/rm $HOME/.sh_history fi if [ "${HISTFILE-unset}" != "unset" ] ; then unset HISTFILE fi if [ "${HISTSIZE-unset}" != "unset" ] ; then unset HISTSIZE fi
For ssh-based method, add the following line to your ~/.ssh/environment:
HISTFILE=/dev/null
- Where are remote files trashed to?
Emacs can trash file instead of deleting them. Remote files are always trashed to the local trash, except remote encrypted files (see Protect remote files by encryption), which are deleted anyway.
If Emacs is configured to use the XDG conventions for the trash directory, remote files cannot be restored with the respective tools, because those conventions don’t specify remote paths. Such files must be restored by moving them manually from ${XDG_DATA_HOME}/Trash/files/, if needed.
- How to shorten long file names when typing in TRAMP?
Adapt several of these approaches to reduce typing. If the full name is /ssh:news@news.my.domain:/opt/news/etc, then:
- Use simplified syntax:
If you always apply the default method (see Selecting a default method), you could use the simplified TRAMP syntax (see Alternative file name syntax):
(customize-set-variable 'tramp-default-method "ssh") (tramp-change-syntax 'simplified)
The reduced typing: C-x C-f
/news@news.my.domain:/opt/news/etc
RET. - Use default values for method name and user name:
You can define default methods and user names for hosts, (see Selecting a default method, see Selecting a default user):
(custom-set-variables '(tramp-default-method "ssh") '(tramp-default-user "news"))
The reduced typing: C-x C-f /-:news.my.domain:/opt/news/etc RET.
Note that there are some useful shortcuts already. Accessing your local host as ‘root’ user, is possible just by C-x C-f /su:: RET.
- Use configuration options of the access method:
Programs used for access methods already offer powerful configurations (see Selecting config files for user/host name completion). For ssh, configure the file ~/.ssh/config:
Host xy HostName news.my.domain User news
The reduced typing: C-x C-f /ssh:xy:/opt/news/etc RET.
Depending on the number of files in the directories, host names completion can further reduce key strokes: C-x C-f /ssh:x TAB.
- Use environment variables to expand long strings:
For long file names, set up environment variables that are expanded in the minibuffer. Environment variables are set either outside Emacs or inside Emacs with Lisp:
(setenv "xy" "/ssh:news@news.my.domain:/opt/news/etc/")
The reduced typing: C-x C-f $xy RET.
Note that file name cannot be edited here because the environment variables are not expanded during editing in the minibuffer.
- Define own keys:
Redefine another key sequence in Emacs for C-x C-f:
(global-set-key [(control x) (control y)] (lambda () (interactive) (find-file (read-file-name "Find TRAMP file: " "/ssh:news@news.my.domain:/opt/news/etc/"))))
Simply typing C-x C-y would prepare minibuffer editing of file name.
See the Emacs Wiki for a more comprehensive example.
- Define own abbreviation (1):
Abbreviation list expansion can be used to reduce typing long file names:
(add-to-list 'directory-abbrev-alist '("^/xy" . "/ssh:news@news.my.domain:/opt/news/etc/"))
The reduced typing: C-x C-f /xy RET.
Note that file name cannot be edited here because the abbreviations are not expanded during editing in the minibuffer. Furthermore, the abbreviation is not expanded during TAB completion.
- Define own abbreviation (2):
The
abbrev-mode
gives additional flexibility for editing in the minibuffer:(define-abbrev-table 'my-tramp-abbrev-table '(("xy" "/ssh:news@news.my.domain:/opt/news/etc/")))
(add-hook 'minibuffer-setup-hook (lambda () (abbrev-mode 1) (setq local-abbrev-table my-tramp-abbrev-table)))
(defadvice minibuffer-complete (before my-minibuffer-complete activate) (expand-abbrev))
The reduced typing: C-x C-f xy TAB.
The minibuffer expands for further editing.
- Use bookmarks:
Use bookmarks to save TRAMP file names.
Upon visiting a location with TRAMP, save it as a bookmark with menu-bar edit bookmarks set.
To revisit that bookmark: menu-bar edit bookmarks jump.
- Use recent files:
recentf remembers visited places.
Keep remote file names in the recent list without have to check for their accessibility through remote access:
(recentf-mode 1)
Reaching recently opened files: menu-bar file Open Recent.
- Use filecache:
Since filecache remembers visited places, add the remote directory to the cache:
(with-eval-after-load 'filecache (file-cache-add-directory "/ssh:news@news.my.domain:/opt/news/etc/"))
Then use directory completion in the minibuffer with C-x C-f C-TAB.
- Use bbdb:
bbdb has a built-in feature for Ange FTP files, which also works for TRAMP file names.
Load bbdb in Emacs:
(require 'bbdb) (bbdb-initialize)
Create a BBDB entry with M-x bbdb-create-ftp-site RET. Then specify a method and user name where needed. Examples:
M-x bbdb-create-ftp-site RET Ftp Site: news.my.domain RET Ftp Directory: /opt/news/etc/ RET Ftp Username: ssh:news RET Company: RET Additional Comments: RET
In BBDB buffer, access an entry by pressing the key F.
Thanks to TRAMP users for contributing to these recipes.
- Use simplified syntax:
- Why saved multi-hop file names do not work in a new Emacs session?
When saving ad-hoc multi-hop TRAMP file names (see Declaring multiple hops in the file name) via bookmarks, recent files, filecache, bbdb, or another package, use the full ad-hoc file name including all hops, like /ssh:bird@bastion|ssh:news.my.domain:/opt/news/etc.
Alternatively, when saving abbreviated multi-hop file names /ssh:news@news.my.domain:/opt/news/etc, the user option
tramp-save-ad-hoc-proxies
must be set non-nil
value. - How to connect to a remote Emacs session using TRAMP?
Configure Emacs Client
Then on the remote host, start the Emacs Server:
(require 'server) (setq server-host (system-name) server-use-tcp t) (server-start)
If
(system-name)
of the remote host cannot be resolved on the local host, use IP address instead.Copy from the remote host the resulting file ~/.emacs.d/server/server to the local host, to the same location.
Then start Emacs Client from the command line:
$ emacsclient /ssh:user@host:/file/to/edit
user
andhost
refer to the local host.To make Emacs Client an editor for other programs, use a wrapper script emacsclient.sh:
#!/bin/sh emacsclient /ssh:$(whoami)@$(hostname --fqdn):$1
Then change the environment variable
EDITOR
to point to the wrapper script:$ export EDITOR=/path/to/emacsclient.sh
- How to determine whether a buffer is remote?
The buffer-local variable
default-directory
tells this. If the form(file-remote-p default-directory)
returns non-nil
, the buffer is remote. See the optional arguments offile-remote-p
for determining details of the remote connection. - How to save files when a remote host isn’t reachable anymore?
If the local machine Emacs is running on changes its network integration, remote hosts could become unreachable. This happens for example, if the local machine is moved between your office and your home without restarting Emacs.
In such cases, the command
tramp-rename-files
can be used to alter remote buffers’ method, host, and/or directory names. This permits saving their contents in the same location via another network path, or somewhere else entirely (including locally). see Renaming remote files. - How to prevent TRAMP from clearing the
recentf-list
?When TRAMP cleans a connection, it removes the respective remote file name(s) from
recentf-list
. This is needed, because an unresponsive remote host could triggerrecentf
to connect that host again and again.If you find the cleanup disturbing, because the file names in
recentf-list
are precious to you, you could add the following two forms in your ~/.emacs after loading thetramp
andrecentf
packages:(remove-hook 'tramp-cleanup-connection-hook #'tramp-recentf-cleanup)
(remove-hook 'tramp-cleanup-all-connections-hook #'tramp-recentf-cleanup-all)
- I get a warning ‘Tramp has been compiled with Emacs a.b, this is Emacs c.d’
- I get an error ‘tramp-file-name-handler: Invalid function:
tramp-compat-with-mutex’
TRAMP comes with compatibility code for different Emacs versions. When you see such a message (the text might differ), you don’t use the Emacs built-in version of TRAMP, and you must recompile it. In case you have installed TRAMP from GNU ELPA, see https://www.gnu.org/software/tramp/#ELPA-Installation. Otherwise, see https://www.gnu.org/software/tramp/#Recompilation.
- I get an error ‘Remote file error: Forbidden reentrant call of Tramp’
Timers, process filters and sentinels, and other event based functions can run at any time, when a remote file operation is still running. This can cause TRAMP to block. When such a situation is detected, this error is triggered. It should be fixed in the respective function (sending an error report will help), but for the time being you can suppress this error by the following code in your ~/.emacs:
(setq debug-ignored-errors (cons 'remote-file-error debug-ignored-errors))
- How to disable other packages from calling TRAMP?
There are packages that call TRAMP without the user ever entering a remote file name. Even without applying a remote file syntax, some packages enable TRAMP on their own. How can users disable such features.
- - ido.el
Disable TRAMP file name completion:
(customize-set-variable 'ido-enable-tramp-completion nil)
- - rlogin.el
Disable remote directory tracking mode:
(rlogin-directory-tracking-mode -1)
- - ido.el
- How to disable TRAMP?
- - To keep Ange FTP as default the remote files access package, set this
in .emacs:
(customize-set-variable 'tramp-default-method "ftp")
If you want to enable Ange FTP’s syntax, add the following form:
(tramp-change-syntax 'simplified)
- -
To disable both TRAMP (and Ange FTP), set
tramp-mode
tonil
in .emacs. Note, that we don’t usecustomize-set-variable
, in order to avoid loading TRAMP.(setq tramp-mode nil)
- -
To deactivate TRAMP for some look-alike remote file names, set
tramp-ignored-file-name-regexp
to a proper regexp in .emacs. Note, that we don’t usecustomize-set-variable
, in order to avoid loading TRAMP.(setq tramp-ignored-file-name-regexp "\\`/ssh:example\\.com:")
This is needed, if you mount for example a virtual file system on your local host’s root directory as /ssh:example.com:.
- - To unload TRAMP, type M-x tramp-unload-tramp RET. Unloading TRAMP resets Ange FTP plugins also.
- - To keep Ange FTP as default the remote files access package, set this
in .emacs:
Next: How to Customize Traces, Previous: Frequently Asked Questions, Up: TRAMP 2.5.3.28.2 User Manual [Contents][Index]
8 How file names, directories and localnames are mangled and managed
Next: Integrating with external Lisp packages, Up: How file names, directories and localnames are mangled and managed [Contents][Index]
8.1 Splitting a localname into its component parts
TRAMP package redefines lisp functions
file-name-directory
and file-name-nondirectory
to
accommodate the unique file naming syntax that TRAMP requires.
The replacements dissect the file name, use the original handler for the localname, take that result, and then re-build the TRAMP file name. By relying on the original handlers for localnames, TRAMP benefits from platform specific hacks to the original handlers.
Previous: Splitting a localname into its component parts, Up: How file names, directories and localnames are mangled and managed [Contents][Index]
8.2 Integrating with external Lisp packages
In general, it is not recommended to use TRAMP functions and variables not described in this manual. They might change their signature and/or semantics without any announcement.
8.2.1 File name completion
Sometimes, it is not convenient to open a new connection to a remote
host, including entering the password and alike. For example, this is
nasty for packages providing file name completion. Such a package
could signal to TRAMP, that they don’t want it to establish a
new connection. Use the variable non-essential
temporarily and
bind it to non-nil
value.
(let ((non-essential t)) …)
8.2.2 File attributes cache
Keeping a local cache of remote file attributes in sync with the remote host is a time-consuming operation. Flushing and re-querying these attributes can tax TRAMP to a grinding halt on busy remote servers.
To get around these types of slow-downs in TRAMP’s
responsiveness, set the process-file-side-effects
to nil
to stop TRAMP from flushing the cache. This is helpful in
situations where callers to process-file
know there are no file
attribute changes. The let-bind form to accomplish this:
(let (process-file-side-effects) …)
For asynchronous processes, TRAMP uses a process sentinel to
flush file attributes cache. When callers to start-file-process
know beforehand no file attribute changes are expected, then the
process sentinel should be set to the default state. In cases where
the caller defines its own process sentinel, TRAMP’s process
sentinel is overwritten. The caller can still flush the file
attributes cache in its process sentinel with this code:
(unless (memq (process-status proc) '(run open)) (dired-uncache remote-directory))
Since TRAMP traverses subdirectories starting with the
root directory, it is most likely sufficient to make the
default-directory
of the process buffer as the root directory.
8.2.3 Timers
Timers run asynchronously at any time when Emacs is waiting for
sending a string to a process, or waiting for process output. They
can run any remote file operation, which would conflict with the
already running remote file operation, if the same connection is
affected. TRAMP detects this situation, and raises the
remote-file-error
error. A timer function should avoid this
situation. As a minimum, it should protect itself against this error, by
wrapping the timer function body as follows:
(ignore-error 'remote-file-error …)
Next: GNU Free Documentation License, Previous: How file names, directories and localnames are mangled and managed, Up: TRAMP 2.5.3.28.2 User Manual [Contents][Index]
9 How to Customize Traces
TRAMP messages are raised with verbosity levels ranging from 0
to 10. TRAMP does not display all messages; only those with a
verbosity level less than or equal to tramp-verbose
.
The verbosity levels are
0 silent (no TRAMP messages at all)
1 errors
2 warnings
3 connection to remote hosts (default verbosity)
4 activities
5 internal
6 sent and received strings
7 connection properties
8 file caching
9 test commands
10 traces (huge)
11 call traces (maintainer only)
With tramp-verbose
greater than or equal to 4, messages are
also written to a TRAMP debug buffer. Such debug buffers are
essential to bug and problem analyzes. For TRAMP bug reports,
set the tramp-verbose
level to 6 (see Reporting Bugs and Problems).
The debug buffer is in Outline Mode. In this buffer, messages can be filtered by their level. To see messages up to verbosity level 5, enter C-u 6 C-c C-q.
TRAMP handles errors internally. Hence, to get a Lisp backtrace, the following settings are required:
(setq debug-on-error t debug-on-signal t)
If tramp-verbose
is greater than or equal to 10, Lisp
backtraces are also added to the TRAMP debug buffer in case of
errors.
In very rare cases it could happen, that TRAMP blocks Emacs. Killing Emacs does not allow inspecting the debug buffer. In that case, you can instruct TRAMP to mirror the debug buffer to a file:
(customize-set-variable 'tramp-debug-to-file t)
The debug buffer is written as a file in your
temporary-file-directory
, which is usually /tmp/. Use
this option with care, because it could decrease the performance of
TRAMP actions.
If tramp-verbose
is greater than or equal to 11, TRAMP
function call traces are written to the buffer *trace-output*.
Next: Function Index, Previous: How to Customize Traces, Up: TRAMP 2.5.3.28.2 User Manual [Contents][Index]
Appendix A GNU Free Documentation License
Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. https://fsf.org/ Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
- PREAMBLE
The purpose of this License is to make a manual, textbook, or other functional and useful document free in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others.
This License is a kind of “copyleft”, which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software.
We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference.
- APPLICABILITY AND DEFINITIONS
This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The “Document”, below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as “you”. You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law.
A “Modified Version” of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language.
A “Secondary Section” is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document’s overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them.
The “Invariant Sections” are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none.
The “Cover Texts” are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words.
A “Transparent” copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not “Transparent” is called “Opaque”.
Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only.
The “Title Page” means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, “Title Page” means the text near the most prominent appearance of the work’s title, preceding the beginning of the body of the text.
The “publisher” means any person or entity that distributes copies of the Document to the public.
A section “Entitled XYZ” means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as “Acknowledgements”, “Dedications”, “Endorsements”, or “History”.) To “Preserve the Title” of such a section when you modify the Document means that it remains a section “Entitled XYZ” according to this definition.
The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License.
- VERBATIM COPYING
You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and you may publicly display copies.
- COPYING IN QUANTITY
If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document’s license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages.
If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public.
It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document.
- MODIFICATIONS
You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version:
- Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission.
- List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has fewer than five), unless they release you from this requirement.
- State on the Title page the name of the publisher of the Modified Version, as the publisher.
- Preserve all the copyright notices of the Document.
- Add an appropriate copyright notice for your modifications adjacent to the other copyright notices.
- Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below.
- Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document’s license notice.
- Include an unaltered copy of this License.
- Preserve the section Entitled “History”, Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section Entitled “History” in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence.
- Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the “History” section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission.
- For any section Entitled “Acknowledgements” or “Dedications”, Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein.
- Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles.
- Delete any section Entitled “Endorsements”. Such a section may not be included in the Modified Version.
- Do not retitle any existing section to be Entitled “Endorsements” or to conflict in title with any Invariant Section.
- Preserve any Warranty Disclaimers.
If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version’s license notice. These titles must be distinct from any other section titles.
You may add a section Entitled “Endorsements”, provided it contains nothing but endorsements of your Modified Version by various parties—for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard.
You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one.
The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version.
- COMBINING DOCUMENTS
You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers.
The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work.
In the combination, you must combine any sections Entitled “History” in the various original documents, forming one section Entitled “History”; likewise combine any sections Entitled “Acknowledgements”, and any sections Entitled “Dedications”. You must delete all sections Entitled “Endorsements.”
- COLLECTIONS OF DOCUMENTS
You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects.
You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document.
- AGGREGATION WITH INDEPENDENT WORKS
A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an “aggregate” if the copyright resulting from the compilation is not used to limit the legal rights of the compilation’s users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document’s Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate.
- TRANSLATION
Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail.
If a section in the Document is Entitled “Acknowledgements”, “Dedications”, or “History”, the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title.
- TERMINATION
You may not copy, modify, sublicense, or distribute the Document except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, or distribute it is void, and will automatically terminate your rights under this License.
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, receipt of a copy of some or all of the same material does not give you any rights to use it.
- FUTURE REVISIONS OF THIS LICENSE
The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See https://www.gnu.org/licenses/.
Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License “or any later version” applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation. If the Document specifies that a proxy can decide which future versions of this License can be used, that proxy’s public statement of acceptance of a version permanently authorizes you to choose that version for the Document.
- RELICENSING
“Massive Multiauthor Collaboration Site” (or “MMC Site”) means any World Wide Web server that publishes copyrightable works and also provides prominent facilities for anybody to edit those works. A public wiki that anybody can edit is an example of such a server. A “Massive Multiauthor Collaboration” (or “MMC”) contained in the site means any set of copyrightable works thus published on the MMC site.
“CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0 license published by Creative Commons Corporation, a not-for-profit corporation with a principal place of business in San Francisco, California, as well as future copyleft versions of that license published by that same organization.
“Incorporate” means to publish or republish a Document, in whole or in part, as part of another Document.
An MMC is “eligible for relicensing” if it is licensed under this License, and if all works that were first published under this License somewhere other than this MMC, and subsequently incorporated in whole or in part into the MMC, (1) had no cover texts or invariant sections, and (2) were thus incorporated prior to November 1, 2008.
The operator of an MMC Site may republish an MMC contained in the site under CC-BY-SA on the same site at any time before August 1, 2009, provided the MMC is eligible for relicensing.
ADDENDUM: How to use this License for your documents
To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page:
Copyright (C) year your name. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''.
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the “with…Texts.” line with this:
with the Invariant Sections being list their titles, with the Front-Cover Texts being list, and with the Back-Cover Texts being list.
If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation.
If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software.
Next: Variable Index, Previous: GNU Free Documentation License, Up: TRAMP 2.5.3.28.2 User Manual [Contents][Index]
Function Index
Jump to: | M S T |
---|
Jump to: | M S T |
---|
Next: Concept Index, Previous: Function Index, Up: TRAMP 2.5.3.28.2 User Manual [Contents][Index]
Variable Index
Jump to: | A B C D E F H I L N P R S T |
---|
Jump to: | A B C D E F H I L N P R S T |
---|
Previous: Variable Index, Up: TRAMP 2.5.3.28.2 User Manual [Contents][Index]
Concept Index
Jump to: | .
7
A B C D E F G H I J K L M N O P Q R S T U V W X Z |
---|
Jump to: | .
7
A B C D E F G H I J K L M N O P Q R S T U V W X Z |
---|
Footnotes
(1)
Some completion styles, like
substring
or flex
, require to type at least one
character after the trailing ‘:’.