0

My dev machine runs on Fedora (36).

Recently I attempted to scp a file to a remote server (CentOS 7) and got a cryptic error message:

scp: dest open(""): No such file or directory

The command looks something like:

scp -C foo.ext user@internal-vpn-ip:~/

Nothing out of the ordinary, have done this many times over the years without issue. Strange, I thought, everything's up & running, yet scp can't find the remote path. Experimenting a bit I expanded the remote user path:

scp -C foo.ext user@remote-ip:/path/to/user/

and voila, it worked!

The question is, why does ~ path expansion no longer work?

virtualeyes
  • 675
  • 3
  • 12
  • 28

1 Answers1

0

Looks like in RedHat 9+ SCP now uses SFTP under the hood.

In the OpenSSH SCP deprecation page there are a list of incompatabilities and caveats wrt to pre-RedHat 9 and RedHat 9+ systems, including this relevant snippet.

Another difference between the protocols is in the expansion of ~-based path processing. OpenSSH 8.7 and later versions support a special SFTP extension to deal with this expansion. Unfortunately, this extension is not supported in earlier versions, so copying folders from a new version of RHEL to an old one is going to fail if ~ path processing is used. In such cases, the recommended fix is to provide absolute paths.

So that explains the need to manually expand the path. Annoying, but at least now we know why :)

virtualeyes
  • 675
  • 3
  • 12
  • 28