Next: Quoted File Names, Previous: File Archives, Up: Files
You can refer to files on other machines using a special file name syntax:
/host:filename /user@host:filename /user@host#port:filename /method:user@host:filename /method:user@host#port:filename
To carry out this request, Emacs uses either the FTP program or a remote-login program such as ssh, rlogin, or telnet. You can always specify in the file name which method to use—for example, /ftp:user@host:filename uses FTP, whereas /ssh:user@host:filename uses ssh. When you don't specify a method in the file name, Emacs chooses the method as follows:
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.
When the Ange-FTP package is used, Emacs logs in through FTP using your user name or the name user. It may ask you for a password from time to time; this is used for logging in on host. The form using port allows you to access servers running on a non-default TCP port.
If you want to disable backups for remote files, set the variable
ange-ftp-make-backup-files
to nil
.
By default, the auto-save files (see Auto Save Files) for remote
files are made in the temporary file directory on the local machine.
This is achieved using the variable auto-save-file-name-transforms
.
Normally, if you do not specify a user name in a remote file name,
that means to use your own user name. But if you set the variable
ange-ftp-default-user
to a string, that string is used instead.
(The Emacs package that implements FTP file access is called
ange-ftp
.)
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
, the user is prompted
for a password as normal.
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
ange-ftp-smart-gateway
to 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>.
You can entirely turn off the FTP file name feature by removing the
entries ange-ftp-completion-hook-function
and
ange-ftp-hook-function
from the variable
file-name-handler-alist
. You can turn off the feature in
individual cases by quoting the file name with ‘/:’ (see Quoted File Names).