Skip to content

tailcat cp fails with unclear error message on openSSH versions < 9.0 #114

Closed

Description

@craigteegarden

This seems to be from tailcat assuming scp defaults to the sftp protocol and fails on the versions of scp that use the traditional scp/rcp protocol by default.

For example, on Ubuntu 22.04:

ssh -V
OpenSSH_8.9p1 Ubuntu-3, OpenSSL 3.0.2 15 Mar 2022

Using the built in file serving:

tailcat serve --files=receive:rw files

The error is:

tailcat cp <tc address>:testfile.txt :receivefile.txt
this tailcat server only offers file transfer (SFTP); shell and exec sessions are disabled

tailcat ls works since it is directly implemented and doesn't use the scp client.

Using -s with ProxyCommand works as expected:

scp -s \
  -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR \
  -o "ProxyCommand=tailcat <tc address> 22" \
  tc:testfile.txt receivefile.txt

In 9.0 (released in 2022), scp was switched to use sftp by default, versions 8.7 - 8.9 add the option to supply the -s flag to opt in to sftp instead of the traditional protocol, which allows tailcat cp to work correctly. I encountered this on Ubuntu 22.04 (LTS is supported until May 2027). scp also works when manually using the ProxyCommand and adding -s. 9.0 also added a flag, -O, to opt in to using the legacy protocol.

I'm not sure if it's in scope to support the older versions (I also think nothing before 8.7 would work in any case), but detecting the ability to use the -s and adding when appropriate seems to allow >=8.7 to work. I suppose a direct implementation that avoids external binaries like tailcat ls would solve it for all situations.

In either case, maybe there is a way to detect this situation and improve the error message so the user knows how to work around it.

Activity

  1. bradfitz commented on Sep 17, 2026

    @bradfitz
    Member

    Thanks for the bug report!

    More history I was looking into:

      History of scp's SFTP mode
    
      Upstream OpenSSH
    
      ┌───────────┬───────────┬───────────────────────────────────────────────────────────────────────────────────────────────┐
      │  Release  │   Date    │                                         scp behaviour                                         │
      ├───────────┼───────────┼───────────────────────────────────────────────────────────────────────────────────────────────┤
      │ 8.6 and   │ to Apr    │ Legacy SCP/RCP protocol only. No -s, no -O. Rejects -s as an unknown option.                  │
      │ older     │ 2021      │                                                                                               │
      ├───────────┼───────────┼───────────────────────────────────────────────────────────────────────────────────────────────┤
      │           │           │ Adds experimental SFTP mode behind -s, plus -O to force legacy. Adds -D sftp_server_path.     │
      │ 8.7       │ Aug 2021  │ Adds the expand-path@openssh.com server extension for ~ paths. Remote-to-remote copies go via │
      │           │           │  the local host by default.                                                                   │
      ├───────────┼───────────┼───────────────────────────────────────────────────────────────────────────────────────────────┤
      │ 8.8, 8.9  │ Sep 2021, │ Still legacy by default. Release notes warn the switch is coming. SFTP mode gains error       │
      │           │  Feb 2022 │ continuation, recursive destination creation, and ~ fixes.                                    │
      ├───────────┼───────────┼───────────────────────────────────────────────────────────────────────────────────────────────┤
      │ 9.0       │ Apr 2022  │ SFTP becomes the default. -O selects legacy. -s stays as a no-op and is still accepted in     │
      │           │           │ 10.x today.                                                                                   │
      ├───────────┼───────────┼───────────────────────────────────────────────────────────────────────────────────────────────┤
      │ 9.1       │ Oct 2022  │ Fixes an SFTP-mode truncation bug and adds the home-directory extension server-side.          │
      ├───────────┼───────────┼───────────────────────────────────────────────────────────────────────────────────────────────┤
      │ 9.2       │ Feb 2023  │ Adds -X for SFTP buffer size and in-flight request count.                                     │
      ├───────────┼───────────┼───────────────────────────────────────────────────────────────────────────────────────────────┤
      │ 9.4, 9.5  │ 2023      │ Fixes for servers that reorder requests and for symlinked directories in recursive SFTP       │
      │           │           │ copies.                                                                                       │
      └───────────┴───────────┴───────────────────────────────────────────────────────────────────────────────────────────────┘
    
      The Red Hat twist. Fedora 35 and later, RHEL 9, and Amazon Linux 2023 carry openssh-8.7p1-sftp-default-protocol.patch, which
      flips 8.7p1 to SFTP by default years before upstream. Their scp accepts -s but hides it from the usage line, and their -O
      still works. RHEL 9.8 and its Alma and Rocky rebuilds have since rebased to 9.9p1. So the Red Hat family has never been
      affected by this bug.
    
      Linux distributions
    
      ┌────────────────────────────────────┬───────────────┬─────────┬─────────────┬──────────────────────────────┐
      │               Distro               │    OpenSSH    │ Default │ -s accepted │ tailcat cp to a files server │
      ├────────────────────────────────────┼───────────────┼─────────┼─────────────┼──────────────────────────────┤
      │ Ubuntu 20.04                       │ 8.2p1         │ legacy  │ no          │ never works via scp          │
      ├────────────────────────────────────┼───────────────┼─────────┼─────────────┼──────────────────────────────┤
      │ Debian 11                          │ 8.4p1         │ legacy  │ no          │ never works via scp          │
      ├────────────────────────────────────┼───────────────┼─────────┼─────────────┼──────────────────────────────┤
      │ Ubuntu 22.04                       │ 8.9p1         │ legacy  │ yes         │ needs this PR                │
      ├────────────────────────────────────┼───────────────┼─────────┼─────────────┼──────────────────────────────┤
      │ RHEL 9.0 to 9.7, Amazon Linux 2023 │ 8.7p1 patched │ SFTP    │ yes         │ works already                │
      ├────────────────────────────────────┼───────────────┼─────────┼─────────────┼──────────────────────────────┤
      │ RHEL 9.8, Alma 9, Rocky 9          │ 9.9p1         │ SFTP    │ yes         │ works already                │
      ├────────────────────────────────────┼───────────────┼─────────┼─────────────┼──────────────────────────────┤
      │ Debian 12                          │ 9.2p1         │ SFTP    │ yes         │ works already                │
      ├────────────────────────────────────┼───────────────┼─────────┼─────────────┼──────────────────────────────┤
      │ Ubuntu 24.04                       │ 9.6p1         │ SFTP    │ yes         │ works already                │
      ├────────────────────────────────────┼───────────────┼─────────┼─────────────┼──────────────────────────────┤
      │ Alpine 3.20                        │ 9.7p1         │ SFTP    │ yes         │ works already                │
      └────────────────────────────────────┴───────────────┴─────────┴─────────────┴──────────────────────────────┘
    
      Ubuntu 22.04 is effectively the entire population this PR fixes. It is supported until April 2027.
    
      macOS
    
      ┌─────────────┬───────────────────────────────┬──────────────────────────────┐
      │    macOS    │        Bundled OpenSSH        │ tailcat cp to a files server │
      ├─────────────┼───────────────────────────────┼──────────────────────────────┤
      │ Monterey 12 │ 8.6p1                         │ never works via scp, no -s   │
      ├─────────────┼───────────────────────────────┼──────────────────────────────┤
      │ Ventura 13  │ 9.0p1                         │ works, SFTP default          │
      ├─────────────┼───────────────────────────────┼──────────────────────────────┤
      │ Sonoma 14   │ 9.6p1, then 9.7p1 in 14.6     │ works                        │
      ├─────────────┼───────────────────────────────┼──────────────────────────────┤
      │ Sequoia 15  │ 9.8p1, then 9.9p2             │ works                        │
      ├─────────────┼───────────────────────────────┼──────────────────────────────┤
      │ Tahoe 26    │ 10.x, exact string unverified │ works                        │
      └─────────────┴───────────────────────────────┴──────────────────────────────┘
    
      Apple builds against LibreSSL and adds Keychain patches but leaves scp's protocol default alone. Monterey users need Homebrew
      or MacPorts openssh, which is 10.x. Homebrew's build is subject to the Sequoia unsigned-binary networking gotcha. Also note
      the BSD libc "illegal option" wording differs from Linux; the PR handles both.
    
  2. added a commit that references this issue on Sep 17, 2026
    e4148d5
  3. added a commit that references this issue on Sep 18, 2026
    6b10612
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions