How to make scp to use ipv6 addresses?

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


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