M BUZZ CRAZE NEWS
// general

escape character not working in scp

By Gabriel Cooper

I am trying to transfer some file through scp. But it is not working,

scp "vogo_psql_db\:2017-08-30T18\:00\:01.762662" ":db-dump"
ssh: Could not resolve hostname vogo_psql_db\\: Name or service not known

The problem is I think that due to colons, it is taking vogo_psql_db as hostname even though the escape chars have been used.

What should be done to solve this ?

2

1 Answer

According to the manual page man scp:

File names may contain a user and host specification to indicate that the
file is to be copied to/from that host. Local file names can be made
explicit using absolute or relative pathnames to avoid scp treating file
names containing ‘:’ as host specifiers. Copies between two remote hosts
are also permitted.

So, you can prepend the local filename with an absolute path, or just the simple relative path ./ i.e.

scp "./vogo_psql_db:2017-08-30T18:00:01.762662" ":db-dump"

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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