I recently upgraded a box to 24.04 and several scripts using scp are failing.

They work perfectly on an older box but the new box can't copy the files and results in a "No such file or directory" error. Same with rsync.

ssh works perfectly, it's just copying files that fails.

I have checked and the old box uses openssh 8.9p1 and the receiving box uses openssh 8.2p1. However, the new 24.04 box uses 9.6p1, so I'm guessing it's an ssh compatibility thing between versions.

I currently can't upgrade OpenSSH on the receiving host, so does anyone have any suggestions on what could be done to get scp working again? I am hoping some sort of config change may help it work with the older version on the receiving box.

  • 2
    scp by default now uses the sftp protocol under the hood - there's an option -O to request legacy scp protocol so I'd try that as a first step Commented Jun 13 at 11:01
  • @steeldriver thank you! That is what I have been googling for for hours trying find.
    – JDN
    Commented Jun 13 at 14:44
  • 1
    OK thanks - I have added an answer since it may help others with the same issue Commented Jun 13 at 15:43
  • superuser.com/a/1733992/432690 Commented Jun 13 at 22:51
  • The noise in the background is that of a zillion admins scrambling to fix their broken scripts in production settings. Boy this is a breaking one...
    – kos
    Commented Jun 14 at 1:11

1 Answer 1


Yes the behavior of scp has changed between Ubuntu 22.04 (openssh 8.9p1) and 24.04 (openssh 9.6p1). From apt changelog openssh-client:

openssh (1:9.0p1-1) unstable; urgency=medium

  * New upstream release (https://www.openssh.com/releasenotes.html#9.0p1):
    - scp(1): Use the SFTP protocol by default (closes: #144579, #204546,
      #327019). This changes scp's quoting semantics by no longer performing
      wildcard expansion using the remote shell, and (with some server
      versions) no longer expanding ~user paths. The -O option is available
      to use the old protocol. See NEWS.Debian for more details.

There's not enough detail in your question to determine exactly how the change might have affected your case, however you can request the legacy SCP protocol in the newer client by adding the -O command line option:

   -O      Use  the  legacy SCP protocol for file transfers instead of the
           SFTP protocol.  Forcing the use of the SCP protocol may be nec‐
           essary for servers that do not implement SFTP,  for  backwards-
           compatibility for particular filename wildcard patterns and for
           expanding paths with a ‘~’ prefix for older SFTP servers.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .