Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am running Ubuntu server 10.04.1 on an x86 box, and all seems ok, however, I have also installed apache2 and proftpd, and configured them as per documentation.

I am having problems when I download non-text files (Binaries, images, etc) they appear to be treated as text, resulting in an unusable file received by the client machine. I have tried both vsftpd and currently proftpd on the server with the same result. When downloading files using http (from the Apache server) the same thing occurs. I tried removing ufw (the firewall) and rebooting, but it made no difference. It seems that the problem lies within Ubuntu itself, and it is a serious problem, as it makes this machine useless as a web server.

Is there a fix and what is it please?

share|improve this question
How did you put those files on the server? – JanC Nov 21 '10 at 2:28
JanC - I tried 2 methods, firstly, a USB drive, and secondly, via Binary FTP. I checked the files while on the server and they are intact, it is not until I download them from the server to the client machine (using binary FTP or HTTP in firefox) that the corruption occurs. It appears that the files'mime-header is being altered, rendering the file unusable. – James Cutler Nov 21 '10 at 3:59
Is there any encryption involved? – Takkat Nov 21 '10 at 8:51
No encryption. The files are fine when uploaded, and if I copy them from the server using sneakernet (or any other non-network method) they are fine. – James Cutler Nov 21 '10 at 10:32
If you still have the system available ,can you try 'sudo apt-get install libwww-perl' followed by 'HEAD path/to/file'; and show the full output? – SpamapS Nov 28 '10 at 1:23

If you leave it be, Apache is configured to do the right thing. It determines a file's content and serves the correct MIME type. Try the following:

  • Use an example file of a common file type: JPEG.
  • Check whether the server really returns the wrong MIME type. To do this, use curl locally, e.g.:

    curl -I http://localhost/file.jpg

    The MIME type should appear in the header.

  • Change back to the default configuration (the one from the Ubuntu package). Apache configuration can be somewhat tricky to get right. Put files in the www (probably /var/www)

  • Make incremental changes from a known-good to a known-bad configuration. This way you can figure out where you misstepped.

Your difficulties with proftpd are probably a different problem altogether.

share|improve this answer
Thanks guys - I ended up starting again with Ubuntu server 10.10, and voila! No problem now. (Actually, I just elected to install LAMP) - and then VSFTPD too :) – James Cutler Nov 23 '10 at 6:16
Glad you got it working. It's usually instructive to fix this type of problem by trying to discover the root cause, however. As you are well aware this is not a 10.10 vs 10.04 problem. – loevborg Nov 23 '10 at 8:41
Note that apache does not actually inspect the file's contents to "determine its content" by default.. it does so by extension only, as inspecting the files' contents would be a drain on performance. If that behavior is desired, 'sudo a2enmod mime_magic' followed by 'sudo service apache2 restart' will enable that. – SpamapS Nov 28 '10 at 1:20

Perhaps the Apache "mime" module is not enabled? Try enabling it:

sudo a2enmod mime

Then check your /etc/apache2/mods-enabled/mime.conf for further details. You may need to examine your /etc/mime.types file as well which contains the mappings from extensions to MIME types. And for way more details, see the official Apache mod_mime documentation.

share|improve this answer
Thanks - but I am afraid that this is not the issue, as the mime module is already enabled in apache2, and my mime.types file is in existence in the /etc directory and appears to be correct. It does seem like a mime issue, but none of the usual remedies appear to be working here. Thank you for trying anyway :) – James Cutler Nov 21 '10 at 8:31
Did I mention, that this phenomenon occurs when GETing files via FTP. Files uploaded to the server are fine, the corruption does not occur until I retrieve files from the server. It makes no difference if I use a windows or linux client, the fault is still present. – James Cutler Nov 21 '10 at 8:51

Your Answer


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.