Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 160.135.126.21
 Logged in as user
 TYPE: ASCII
 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
share|improve this question
    
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. –  Andrew Smith Jul 1 '12 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 '12 at 16:45
    
So this is FTP Server, because windows client does this conversion by default on *.txt files. –  Andrew Smith Jul 1 '12 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? –  Andrew Smith Jul 1 '12 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 '12 at 17:21
show 6 more comments

1 Answer

up vote 2 down vote accepted

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:

ascii_upload_enable=YES
ascii_download_enable=YES
share|improve this answer
    
Thank you! This solved the problem. Right now the conversion is done automatically when in ASCII mode. –  Jagger Jul 2 '12 at 18:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.