SFTP only works on ipv4, not ipv6
I have a Debian 10 Linode where SSH works over ipv4 and ipv6, but SFTP only works over ipv4. Does the final error message ring a bell to anyone?
~$ ssh [email protected]
Linux website 4.19.0-13-amd64 #1 SMP Debian 4.19.160-2 (2020-11-28) x86_64
The programs included with the Debian GNU/Linux system are free software;
...
~$ ssh [email protected]:8907::xxxx:xxxx:xxxx:xxxx
Linux website 4.19.0-13-amd64 #1 SMP Debian 4.19.160-2 (2020-11-28) x86_64
The programs included with the Debian GNU/Linux system are free software;
...
~$ sftp [email protected]
Connected to [email protected]
sftp>_
~$ sftp [email protected]:8907::xxxx:xxxx:xxxx:xxxx
ssh: connect to host 0.0.9.96 port 22: Invalid argument
Connection closed.
Connection closed
Thanks,
Vaughan
1 Reply
The sftp manpage states the following:
Since the destination formats use colon characters to delimit host names
from path names or port numbers, IPv6 addresses must be enclosed in
square brackets to avoid ambiguity.
Without the square brackets, it's interpreting 2400 (the string between the @ and the first :) as an IPv4 address, hence why the error message says 0.0.9.96.