40

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
AJM
  • 205
Osis
  • 753

2 Answers2

64

scp requires some special syntax. The IPv6 address must be enclosed in brackets, which must then be escaped to prevent the shell from performing filename expansion on an apparent bracket expression. So in your example it would look like this:

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

Or:

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

Without the brackets, 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).

muru
  • 207,228
4

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
singrium
  • 7,320
Jobin
  • 141