Next: , Previous: , Up: Configuration   [Contents][Index]

4.3 External methods

The external methods operate through multiple channels, using the remote shell connection for many actions while delegating file transfers to an external transfer utility.

This saves the overhead of encoding and decoding that multiplexing the transfer through the one connection has with the inline methods.

Since external methods need their own overhead opening a new channel, all files which are smaller than tramp-copy-size-limit are still transferred with the corresponding inline method. It should provide a fair trade-off between both approaches.

rcprsh and rcp

This method uses the rsh and rcp commands to connect to the remote host and transfer files. This is probably the fastest connection method available.

The alternative method remcp uses the remsh and rcp commands. It should be applied on hosts where remsh is used instead of rsh.

scpssh and scp

Using ssh to connect to the remote host and scp to transfer files between the hosts is the best method for securely connecting to a remote host and accessing files.

The performance of this option is also quite good. It may be slower than the inline methods when you often open and close small files however. The cost of the cryptographic handshake at the start of an scp session can begin to absorb the advantage that the lack of encoding and decoding presents.

All the ssh based methods support the ‘-p’ feature where you can specify a port number to connect to in the host name. For example, the host name host#42 tells TRAMP to specify ‘-p 42’ in the argument list for ssh, and to specify ‘-P 42’ in the argument list for scp.

rsyncssh and rsync

Using the ssh command to connect securely to the remote host and the rsync command to transfer files is almost identical to the scp method.

While rsync performs much better than scp when transferring files that exist on both hosts, this advantage is lost if the file exists only on one side of the connection. A file can exists on both the remote and local host, when you copy a file from/to a remote host. When you just open a file from the remote host (or write a file there), a temporary file on the local side is kept as long as the corresponding buffer, visiting this file, is alive.

This method supports the ‘-p’ argument.

scpxssh and scp

As you would expect, this is similar to scp, only a little different. Whereas scp opens a normal interactive shell on the remote host, this option uses ‘ssh -t -t host -l user /bin/sh’ to open a connection. This is useful for users where the normal login shell is set up to ask them a number of questions when logging in. This procedure avoids these questions, and just gives TRAMP a more-or-less ‘standard’ login shell to work with.

This is also useful for Windows users where ssh, when invoked from an Emacs buffer, tells them that it is not allocating a pseudo tty. When this happens, the login shell is wont to not print any shell prompt, which confuses TRAMP mightily.

This method supports the ‘-p’ argument.

pscpplink and pscp
psftpplink and psftp

These methods are similar to scp or sftp, but they use the plink command to connect to the remote host, and they use pscp or psftp for transferring the files. These programs are part of PuTTY, an SSH implementation for Windows.

With a recent PuTTY, it is recommended to configure the ‘Share SSH connections if possible’ control for that session.

These methods support the ‘-P’ argument.

fcpfsh and fcp

This method is similar to scp, but it uses the fsh command to connect to the remote host, and it uses fcp for transferring the files. fsh/fcp are a front-end for ssh which allow for reusing the same ssh session for submitting several commands. This avoids the startup overhead of scp (which has to establish a secure connection whenever it is called). Note, however, that you can also use one of the inline methods to achieve a similar effect.

This method uses the command ‘fsh host -l user /bin/sh -i’ to establish the connection, it does not work to just say fsh host -l user.

There is no inline method using fsh as the multiplexing provided by the program is not very useful in our context. TRAMP opens just one connection to the remote host and then keeps it open, anyway.

nctelnet and nc

Using telnet to connect to the remote host and nc for file transfer is often the only possibility to access dumb devices, like routers or NAS hosts. Those hosts have just a restricted busybox as local shell, and there is no program to encode and decode files for transfer.

ftp

This is not a native TRAMP method. Instead, it forwards all requests to Ange-FTP.

smbsmbclient

This is another not native TRAMP method. It uses the smbclient command on different Unices in order to connect to an SMB server. An SMB server might be a Samba (or CIFS) server on another UNIX host or, more interesting, a host running MS Windows. So far, it is tested against MS Windows NT, MS Windows 2000, MS Windows XP, MS Windows Vista, and MS Windows 7.

The first directory in the localname must be a share name on the remote host. Remember that the $ character, in which default shares usually end, must be written $$ due to environment variable substitution in file names. If no share name is given (i.e., remote directory /), all available shares are listed.

Since authorization is done on share level, you will always be prompted for a password if you access another share on the same host. This can be suppressed by Password handling.

For authorization, MS Windows uses both a user name and a domain name. Because of this, the TRAMP syntax has been extended: you can specify a user name which looks like user%domain (the real user name, then a percent sign, then the domain name). So, to connect to the host melancholia as user daniel of the domain BIZARRE, and edit .emacs in the home directory (share daniel$) I would specify the file name /smb:daniel%BIZARRE@melancholia:/daniel$$/.emacs.

Depending on the Windows domain configuration, a Windows user might be considered as domain user per default. In order to connect as local user, the WINS name of that host must be given as domain name. Usually, it is the host name in capital letters. In the example above, the local user daniel would be specified as /smb:daniel%MELANCHOLIA@melancholia:/daniel$$/.emacs.

The domain name as well as the user name are optional. If no user name is specified at all, the anonymous user (without password prompting) is assumed. This is different from all other TRAMP methods, where in such a case the local user name is taken.

The smb method supports the ‘-p’ argument.

Please note: If Emacs runs locally under MS Windows, this method isn’t available. Instead, you can use UNC file names like //melancholia/daniel$$/.emacs. The only disadvantage is that there’s no possibility to specify another user name.

adb

This special method uses the Android Debug Bridge for accessing Android devices. The Android Debug Bridge must be installed locally. Some GNU/Linux distributions offer it for installation, otherwise it can be installed as part of the Android SDK. If the adb program is not found via the PATH environment variable, the variable tramp-adb-program must point to its absolute path.

Tramp does not connect Android devices to adb. This must be performed outside Emacs. If there is exactly one Android device connected to adb, a host name is not needed in the remote file name. The default TRAMP name to be used is /adb:: therefore. Otherwise, one could find potential host names with the command adb devices.

Usually, the adb method does not need any user name. It runs under the permissions of the adbd process on the Android device. If a user name is specified, TRAMP applies an su on the device. This does not work with all Android devices, especially with unrooted ones. In that case, an error message is displayed.

Next: , Previous: , Up: Configuration   [Contents][Index]