9

I am using tramp via ssh to access remote files. For text files, this is working really well, but whenever I want to copy larger remote files to my local machine, tramp uses its slow inline method (encoding the file with gzip). This is much slower than using an external method like for example scp. How do I make emacs use scp when transfering large files?

Relevant information:

  • I use an ~/.ssh/config file to access the remote machine. The alias for that machine is hehi09 in the following. The access is password-less

  • Messages in message buffer when transferring:

    Copying /ssh:hehi09:/home/christian/big_file.dat to /home/christian/big_file.dat'...
    Tramp: Inserting `/ssh:hehi09:/home/christian/big_file.dat'...
    Tramp: Encoding remote file `/ssh:hehi09:/home/christian/big_file.dat' with `(gzip <%s | base64)'...
    
  • Values of:

    • tramp-copy-size-limit's value is 10240 (much smaller than tested file size)

    • tramp-default-method's value is "scp"

  • $ scp hehi09:/home/christian/big_file.dat ~/ works as expected from the command line and is much faster than the transfer in emacs

Any ideas why emacs is not using scp to copy large files? Any help is greatly appreciated!

15

When you are saying "I am using tramp via ssh" I suppose you open a file like /ssh:host:/path/to/file. This is supposed to use always the ssh method. If you want to use the scp method, you shall use /scp:host:/path/to/file. This uses automatically ssh for short files, and scp for large files. If you trust the default method set in tramp-default-method, you could use the shorter /host:/path/to/file.

  • It would be nice that it always use both ssh and scp when copying files, regardless of whether /ssh or /scp.. Or at least gives some warning message when copying large binaries with /ssh. Before seeing your answer, i thought emacs is not ready for copying large files via tramp. (since i only used /ssh) – xwl Sep 5 '16 at 13:43
  • 2
    In that case, make scp your default method. Even then, Tramp copies small files via ssh, and large files via scp. You can customize the limit via tramp-copy-size-limit. – Michael Albinus Sep 6 '16 at 9:42
  • 3
    As of Emacs 26, a method is mandatory now in remote file names. You must always say /scp:host:/path/to/file or /ssh:host:/path/to/file . – Michael Albinus Jul 27 '17 at 15:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.