When I try to use scp over IPv6 addresses I get this:

scp -6 osis@::1:/home/osis/test.file ./test.file
ssh: Could not resolve hostname : Name or service not known

With scp all I ever get is

ssh: Could not resolve hostname : Name or service not known

using this I get a login into my box without a hitch

ssh osis@::1

scp requires some special syntax. The IPv6 address must be enclosed in brackets, which must then be escaped. So in your example it would look like this:

scp -6 osis@\[2001:db8:0:1\]:/home/osis/test.file ./test.file

Otherwise the first colon ':' is thought to be the separator between the file and the address parts which would result in

ssh: Could not resolve hostname 2001: Address family for hostname not supported

In your example with the ip ::1 it is interpreted as if you want to ssh to the host '' (blank).

| improve this answer | |
  • thank you for your answer, this info was somehow missing from man scp;man ssh – Osis Nov 22 '10 at 14:24
  • 2
    Consider submitting an updated man page, then you can say: I helped. – Martin Owens -doctormo- Nov 22 '10 at 17:26
  • 2
    When using the -6 flag, you can just type localhost instead of ::1 (which is the IPv6 Address for localhost) to avoid the brackets and therefore any need to escape something on the shell: scp -6 osis@localhost:/home/osis/test.file ./test.file – freddyb Apr 30 '11 at 16:22
  • 1
    You are not supposed to use IPv6 addresses, you are supposed to use DNS names. – Anders Feb 19 '19 at 17:08
  • Note brackets work only with scp, not with ssh. Closed as WONTFIX: bugzilla.mindrot.org/show_bug.cgi?id=1602 – MarcH May 15 at 23:12

The above command didn't work for me, the error I got was due to v6 address was allowed taking for path.

No need to use back slash "\" . As per the above example below command will work.

scp -6 osis@[2001:db8:0:1]:/home/osis/test.file ./test.file
| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.