I am having problems transferring a text file from Windows 7 using ftp.exe to a FreeBSD server. After the file transfer the end-of-line characters are not changed from \r\n to \n, Instead they remain with the carriage return character which can be seen in for example mcedit as ^M. The file is transferred in ascii mode.

Has anybody run into similar problems in the past? As far as I know using the ascii mode during FTP transfer should convert those characters automatically. Does it depend on the server configuration?

EDIT: The file can be seen here.

EDIT: I have also tried with ncftp.exe under Cygwin but the result is the same. The carriage return character has not been removed even if the transfer type was ASCII.

EDIT: It does not work the other way round either. I created a text file in FreeBSD and then downloaded it is ASCII mode to my Windows machine. The end of line characters remained LF as they were in FreeBSD.

EDIT: The lit stat returns

211-FTP server status:
 Connected to
 Logged in as user
 No session bandwidth limit
 Session timeout in seconds is 320
 Control connection is plain text
 Data connections will be plain text
 At session startup, client count was 9
 vsFTPd 2.3.4 - secure, fast, stable
211 End of status
  • Is this UTF or ASCII? Is it like XML? Or is it source code? Check the header of the file in hex dump that it's a normal file. Jul 1, 2012 at 16:42
  • @AndrewSmith: No, it is a "normal" txt file created by notepad.exe. It is not an XML file. I also put a link to the file.
    – Jagger
    Jul 1, 2012 at 16:45
  • So this is FTP Server, because windows client does this conversion by default on *.txt files. Jul 1, 2012 at 16:50
  • Well windows client can do this, are you sure you have this problem, e.g. you are in ASCII mode? Do you have windows XP? Jul 1, 2012 at 16:54
  • @AndrewSmith: Yes I am sure, that I am in ASCII mode. Right now I am trying with another ftp client I will update my question with the results of this research. As described in the question I use Windows 7.
    – Jagger
    Jul 1, 2012 at 17:21

1 Answer 1


vsFTPd, in a misguided effort to make their daemon "very secure", has disabled ASCII EoL conversion by default. It has to be manually re-enabled by editing the configuration (/usr/local/etc/vsftpd.conf by default) file and adding the following lines:

  • Thank you! This solved the problem. Right now the conversion is done automatically when in ASCII mode.
    – Jagger
    Jul 2, 2012 at 18:16
  • Those settings seems completely backwards. When set to NO, unix(mac)-to-unix FTP converted files to crlf line endings. Enabling the setting results in files with the correct unix-lf newline line endings. Thanks!
    – joemaller
    Jan 15, 2015 at 16:11

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.