You can refer to files on other machines using a special file name syntax:
To carry out this request, Emacs uses a remote-login program such as
ssh. You must always specify in the file name which method to use—for example,
ssh. When you specify the pseudo method ‘
-’ in the file name, Emacs chooses the method as follows:
- If the host name starts with ‘
ftp.’ (with dot), Emacs uses FTP.
- If the user name is ‘
ftp’ or ‘
anonymous’, Emacs uses FTP.
- If the variable
tramp-default-methodis set to ‘
ftp’, Emacs uses FTP.
ssh-agentis running, Emacs uses
- Otherwise, Emacs uses
You can entirely turn off the remote file name feature by setting the variable
nil. You can turn off the feature in individual cases by quoting the file name with ‘
/:’ (see Quoted File Names).
Remote file access through FTP is handled by the Ange-FTP package, which is documented in the following. Remote file access through the other methods is handled by the Tramp package, which has its own manual. See The Tramp Manual in The Tramp Manual.
When the Ange-FTP package is used, Emacs logs in through FTP using the name
user, if that is specified in the remote file name. If
user is unspecified, Emacs logs in using your user name on the local system; but if you set the variable
ange-ftp-default-user to a string, that string is used instead. When logging in, Emacs may also ask for a password.
For performance reasons, Emacs does not make backup files for files accessed via FTP by default. To make it do so, change the variable
ange-ftp-make-backup-files to a non-
By default, auto-save files for remote files are made in the temporary file directory on the local machine, as specified by the variable
auto-save-file-name-transforms. See Auto Save Files.
To visit files accessible by anonymous FTP, you use special user names ‘
anonymous’ or ‘
ftp’. Passwords for these user names are handled specially. The variable
ange-ftp-generate-anonymous-password controls what happens: if the value of this variable is a string, then that string is used as the password; if non-
nil (the default), then the value of
user-mail-address is used; if
nil, then Emacs prompts you for a password as usual (see Passwords).
Sometimes you may be unable to access files on a remote machine because a firewall in between blocks the connection for security reasons. If you can log in on a gateway machine from which the target files are accessible, and whose FTP server supports gatewaying features, you can still use remote file names; all you have to do is specify the name of the gateway machine by setting the variable
ange-ftp-gateway-host, and set
t. Otherwise you may be able to make remote file names work, but the procedure is complex. You can read the instructions by typing
M-x finder-commentary RET ange-ftp RET.