Score:0

Routine SCP Command fails (VPN/Network Active)

cn flag

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?

Score:0
cn flag

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 :)

Tom Yan avatar
in flag
`~/` was not necessary anyway. If you want to copy to the home directory of the user, `user@internal-vpn-ip:` should be sufficient.
virtualeyes avatar
cn flag
@TomYan indeed it is, add your comment as an answer.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.