How to transfer binary file in SFTP? How to transfer binary file in SFTP? unix unix

How to transfer binary file in SFTP?


A binary file is a normal file.

You are possibly referring to a text/ascii vs. a binary transfer mode, known from an FTP protocol. The FTP protocol defaults to the text/ascii mode, so one usually had to ensure that the mode was switched to the binary not to corrupt the transferred binary files.

SFTP protocol also supports a text/ascii vs. binary mode distinction in its newer versions. Though contrary to the FTP, the binary mode is the default and one has to explicitly force the text/ascii mode, if desired.

Moreover the ascii/text mode is supported by an SFTP version 4 and newer only. And many SFTP servers/clients (including the most widespread one, the OpenSSH) support an SFTP version 3 only. So they will not even let you use the text/ascii mode.