Next: , Previous: Gateway methods, Up: Configuration

4.6 Selecting a default method

Default method is for transferring files. The variable tramp-default-method sets it. tramp uses this variable to determine the default method for tramp file names that do not have one specified.

     (setq tramp-default-method "ssh")

Default methods for transferring files can be customized for specific user and host combinations through the alist variable tramp-default-method-alist.

For example, the following two lines specify to use the ssh method for all user names matching ‘john’ and the rsync method for all host names matching ‘lily’. The third line specifies to use the su method for the user ‘root’ on the host ‘localhost’.

     (add-to-list 'tramp-default-method-alist '("" "john" "ssh"))
     (add-to-list 'tramp-default-method-alist '("lily" "" "rsync"))
     (add-to-list 'tramp-default-method-alist
                  '("\\`localhost\\'" "\\`root\\'" "su"))

See the documentation for the variable tramp-default-method-alist for details.

External methods performance faster for large files.

See Inline methods. See External methods.

Choosing the access method also depends on the security environment. For example, rsh and telnet methods that use clear text password transfers are inappropriate for over the Internet connections. Secure remote connections should use ssh that provide encryption.

4.6.1 Which method to use?

tramp provides maximum number of choices for maximum flexibility. Choosing which method depends on the hosts, clients, network speeds, and the security context.

Start by using an inline method.

External methods might be more efficient for large files, but most tramp users edit small files more often than large files.

Enable compression, tramp-inline-compress-start-size, for a performance boost for large files.

Since ssh has become the most common method of remote host access and it has the most reasonable security protocols, use ssh method. Typical ssh usage to edit the /etc/motd file on the otherhost:

     C-x C-f /ssh:root@otherhost:/etc/motd <RET>

If ssh is unavailable for whatever reason, look for other obvious options. For Windows, try the plink method. For Kerberos, try krlogin.

For editing local files as su or sudo methods, try the shortened syntax of ‘root’:

     C-x C-f /su::/etc/motd <RET>

For editing large files, scp is faster than ssh. pscp is faster than plink. But this speed improvement is not always true.