Next: , Up: Usage   [Contents][Index]

5.1 TRAMP file name conventions

To access the file localname on the remote host host you would specify the file name /host:localname. This will connect to host and transfer the file using the default method. See Default Method.

Some examples of TRAMP file names are shown below.

/melancholia:.emacs

Edit the file .emacs in your home directory on the host melancholia.

/melancholia.danann.net:.emacs

This edits the same file, using the fully qualified domain name of the host.

/melancholia:~/.emacs

This also edits the same file; the ~ is expanded to your home directory on the remote host, just like it is locally.

/melancholia:~daniel/.emacs

This edits the file .emacs in the home directory of the user daniel on the host melancholia. The ~<user> construct is expanded to the home directory of that user on the remote host.

/melancholia:/etc/squid.conf

This edits the file /etc/squid.conf on the host melancholia.

host can also be an IPv4 or IPv6 address, like in /127.0.0.1:.emacs or /[::1]:.emacs. For syntactical reasons, IPv6 addresses must be embedded in square brackets [ and ].

Unless you specify a different name to use, TRAMP will use the current local user name as the remote user name to log in with. If you need to log in as a different user, you can specify the user name as part of the file name.

To log in to the remote host as a specific user, you use the syntax /user@host:path/to.file. That means that connecting to melancholia as daniel and editing .emacs in your home directory you would specify /daniel@melancholia:.emacs.

It is also possible to specify other file transfer methods (see Inline methods, see External methods) as part of the file name. This is done by putting the method before the user and host name, as in /method: (Note the trailing colon). The user, host and file specification remain the same.

So, to connect to the host melancholia as daniel, using the ssh method to transfer files, and edit .emacs in my home directory I would specify the file name /ssh:daniel@melancholia:.emacs.

A remote file name containing a host name only, which is equal to a method name, is not allowed. If such a host name is used, it must always be preceded by an explicit method name, like /ssh:ssh:.

Finally, for some methods it is possible to specify a different port number than the default one, given by the method. This is specified by adding #<port> to the host name, like in /ssh:daniel@melancholia#42:.emacs.

Next: , Up: Usage   [Contents][Index]