Tramp extends the Emacs file name syntax by a remote component. A remote file name looks always like /method:user@host:/path/to/file.
You can use remote files exactly like ordinary files, that means you
could open a file or directory by C-x C-f
/method:user@host:/path/to/file <RET>, edit the file,
and save it. You can also mix local files and remote files in file
operations with two arguments, like
rename-file. And finally, you can run even processes on a
remote host, when the buffer you call the process from has a remote
Remote file names are prepended by the
host parts. All of them, and also the local file name part,
are optional, in case of a missing part a default value is assumed.
The default value for an empty local file name part is the remote
user's home directory. The shortest remote file name is
/-::, therefore. The ‘-’ notation for the
default host is used for syntactical reasons, Default Host.
method part describes the connection method used to reach
the remote host, see below.
user part is the user name for accessing the remote host.
For the smb method, this could also require a domain name, in
this case it is written as
host part must be a host name which could be resolved on
your local host. It could be a short host name, a fully qualified
domain name, an IPv4 or IPv6 address, File name syntax. Some
connection methods support also a notation of the port to be used, in
this case it is written as
If your local host runs an SSH client, and the remote host runs an SSH server, the most simple remote file name is /ssh:user@host:/path/to/file. The remote file name /ssh:: opens a remote connection to yourself on the local host, and is taken often for testing Tramp.
On MS Windows, PuTTY is often used as SSH client. Its plink method can be used there to open a connection to a remote host running an ssh server: /plink:user@host:/path/to/file.
sudo and sg methods
Sometimes, it is necessary to work on your local host under different
permissions. For this, you could use the su or sudo
connection method. Both methods use ‘root’ as default user name
and the return value of
(system-name) as default host name.
Therefore, it is convenient to open a file as
The method sg stands for “switch group”; the changed group must be used here as user name. The default host name is the same.
In order to access a remote MS Windows host or Samba server, the smbclient client is used. The remote file name syntax is /smb:user%domain@host:/path/to/file. The first part of the local file name is the share exported by the remote host, ‘path’ in this example.
On systems, which have installed the virtual file system for the Gnome Desktop (GVFS), its offered methods could be used by Tramp. Examples are /sftp:user@host:/path/to/file, /afp:user@host:/path/to/file (accessing Apple's AFP file system), /dav:user@host:/path/to/file and /davs:user@host:/path/to/file (for WebDAV shares).
Another GVFS-based method allows to access a Google Drive file system. The file name syntax is here always /gdrive:email@example.com:/path/to/file. ‘firstname.lastname@example.org’ stands here for your Google Drive account.
An Android device, which is connected via USB to your local host, can be accessed via the adb command. No user or host name is needed. The file name syntax is /adb::/path/to/file.