Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
OK... here's the situation: I would like to make a share on a Windows machine accessible to the Internet via Apache installed on a Linux server. I have a Windows ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2007
    Posts
    7

    Accessing a Windows share via Apache on FC5


    OK... here's the situation: I would like to make a share on a Windows machine accessible to the Internet via Apache installed on a Linux server.

    I have a Windows machine (let's call it "winserver"). On winserver, there is a share (winshare). I also have a Linux server (linuxserver) running Fedora Core 5 with Apache 2.2.

    I have mounted winshare on linuxserver as /path/to/share/winshare

    When I run ls -l on /path/to/share/winshare, I see the files on \\winserver\winshare:
    Code:
    [root@linuxserver winshare]# pwd
    /path/to/share/winshare
    [root@linuxserver winshare]# ls -l
    total 280345
    -rwxrwSrwt 1 root root 16352616 Apr 16 15:25 2006_03_12_1030am.mp3
    -rwxrwSrwt 1 root root 13687296 Apr 16 15:27 2006_07_16_1030am.mp3
    -rwxrwSrwt 1 root root    24576 Apr 16 17:01 2006_08_13_1030am.mp3
    -rwxrwSrwt 1 root root 15086232 Apr 16 17:04 2006_08_27_1030am.mp3
    -rwxrwSrwt 1 root root     8192 Apr 16 17:04 2006_09_17_1030am.mp3
    -rwxrwSrwt 1 root root 15563184 Apr 16 17:07 2006_10_15_1030am.mp3
    -rwxrwSrwt 1 root root 14594160 Apr 16 15:20 2007_03_18_1030am.mp3
    -rwxrwSrwt 1 root root 31718271 Apr 16 14:42 2007_04_15_1030am.mp3
    -rwxrwSrwt 1 root root       16 Apr 18 16:49 New Text Document.txt
    I have then created a symlink in /var/www/html called winshare that points to /path/to/share/winshare.

    Then I can go to http://linuxserver/winshare, and I can see the Apache directory listing from \\winserver\winshare.

    Here's the problem: From a remote PC, I can download from http://linuxserver/winshare any ASCII files in the directory, but not binary files. If the file is binary the download simply fails with no explanation. (Firefox says "Starting download..." and then "Done" (instantly) with no resulting file). I can save and view ASCII files (ie, New Text Document.txt) just fine and there are no issues with line breaks.

    If I copy one of the binary files to say, /var/www/html/test/2007_04_15_1030am.mp3, I can go to http://linuxserver/test and download the file fine.

    I'm trying to conserve space on linuxserver and the files on \\winserver\winshare are quite large, so putting them on linuxserver is not an option. I also do not want to install Apache on winserver as winserver is in production use and needs to have as much free RAM as possible and that just doesn't seem like the right way to do it....

    I've Googled and searched and cannot find a similar problem... any ideas?

    Thanks!

  2. #2
    Linux Engineer adrenaline's Avatar
    Join Date
    Aug 2004
    Location
    Seattle, Washington
    Posts
    1,058
    On the Linux box tail -f /var/log/messages

    then try your download again and see if it logs the error

    oh and try the same thing on secure

    tail -f /var/log/secure
    Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
    -- Linus Torvalds

  3. #3
    Just Joined!
    Join Date
    Apr 2007
    Posts
    7
    Thanks for your reply! I tried this, and nothing is logged in either file when I attempt the download.... I double checked that it isn't just MP3s: I put a bitmap and an .exe file in the directory, and neither of them work either....

    This doesn't make sense to me....

  4. #4
    Just Joined!
    Join Date
    Apr 2007
    Posts
    7
    Still haven't resolved this....

    Here's a little more info:

    I put a GIF image named file.gif into winshare.

    If I visit the mount directly on linuxserver via a GUI > Computer > winshare, I can open file.gif in the default image editor. So the mount is working. If I browse to /var/www/html/winshare (the symlink to the mount), I can also open file.gif in the default image editor. So the symlink is working as well.

    If I go to http://localhost/winshare and click file.gif from the directory listing, I get a blank page that says:

    Code:
    http://localhost/winshare/file.gif
    ...as the body of the page. The title in Firefox says "file.gif (Image)".

    It would seem that Apache is returning the names of binary files rather than the files themselves. I'm not sure why it's treating ASCII files differently.

  5. #5
    Linux Engineer adrenaline's Avatar
    Join Date
    Aug 2004
    Location
    Seattle, Washington
    Posts
    1,058
    I think the deal is that your Apache file is set to indexing.

    If you want this turned off do this

    cp /your/httpd.conf /your/httpd.conf.orig
    then edit your http.conf file

    like this

    The files are different but mine looks like this.

    #<Directory /home/*/public_html>
    # AllowOverride FileInfo AuthConfig Limit
    # Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    #
    #</Director>

    edit the Options line to say -Indexes
    That should show the pic rather than make it look like a dloadable file.

    I think that is what you are looking for
    Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
    -- Linus Torvalds

  6. #6
    Just Joined!
    Join Date
    Apr 2007
    Posts
    7
    Thanks for your reply!

    I backed up /etc/httpd/conf/httpd.conf and opened it up and changed:

    Code:
    #<Directory /home/*/public_html>
    #    AllowOverride FileInfo AuthConfig Limit
    #    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    #    <Limit GET POST OPTIONS>
    #        Order allow,deny
    #        Allow from all
    #    </Limit>
    #    <LimitExcept GET POST OPTIONS>
    #        Order deny,allow
    #        Deny from all
    #    </LimitExcept>
    #</Directory>
    to:

    Code:
    <Directory /home/*/public_html>
        Options MultiViews -Indexes SymLinksIfOwnerMatch IncludesNoExec
    </Directory>
    ...and restarted apache. Nothing changed.... I'm just using the default apache config file... was that the right place to make this edit? Researching this option....

    Thanks!

  7. #7
    Just Joined!
    Join Date
    Apr 2007
    Posts
    7
    OK... I understand better. I added:

    Code:
    <Directory /var/www/html/winshare/>
            Options -Indexes 
    </Directory>
    ...to the end of httpd.conf. Now I get a 403 Forbidden error when I go to http://linuxserver/winshare. Changing it to just Indexes or +Indexes removes the 403 error, but the problem persists.

  8. #8
    Linux Engineer adrenaline's Avatar
    Join Date
    Aug 2004
    Location
    Seattle, Washington
    Posts
    1,058
    OK so let me get this straight you want to share a file from your windows box over the internet using your linux box.

    Hmmm

    I am not even positive that is possible.


    just to confirm can you see the windows shared file from your linux box?

    IF so you will have to mount it to a directory you can publish. But It would be a link. hmmm

    I will ponder this.
    Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
    -- Linus Torvalds

  9. #9
    Just Joined!
    Join Date
    Apr 2007
    Posts
    7
    Thanks for your reply! Yes... I want to share a folder which is on a Windows box (with MP3 audio files in it) over the Internet using the Linux box.

    I can indeed see the files:

    Code:
    [root@linuxserver mnt]# pwd
    /mnt
    [root@linuxserver mnt]# ll
    total 4
    drwxrwxrwx 1 root root    0 Jul  1 11:53 winshare
    drwxr-xr-x 2 root root 4096 May 22 16:55 tmp
    [root@linuxserver mnt]# cd winshare
    [root@linuxserver winshare]# ll
    total 296748
    drwxrwxrwx 1 root root        0 Jun 30 09:44 2006
    -rwxrwSrwt 1 root root 15988881 Jun 30 10:34 2007_01_14_1030.mp3
    -rwxrwSrwt 1 root root 15302984 Jun 30 10:36 2007_01_28_1030.mp3
    -rwxrwSrwt 1 root root 18321772 Jun 30 10:37 2007_02_11_1030.mp3
    -rwxrwSrwt 1 root root 18321590 Jun 30 10:39 2007_02_18_1030.mp3
    -rwxrwSrwt 1 root root 17368904 Jun 30 10:41 2007_02_25_1030.mp3
    -rwxrwSrwt 1 root root 15744584 Jun 30 10:42 2007_03_04_1030.mp3
    -rwxrwSrwt 1 root root 14596790 Jun 30 10:44 2007_03_18_1030.mp3
    -rwxrwSrwt 1 root root 14405338 Jun 30 10:45 2007_03_25_1030.mp3
    -rwxrwSrwt 1 root root 13909027 Jun 30 10:46 2007_04_15_1030.mp3
    -rwxrwSrwt 1 root root 17189338 Jun 30 10:48 2007_04_22_1030.mp3
    [root@linuxserver winshare]# cd /var/www/html
    [root@linuxserver html]# ll
    total 24
    drwxr-xr-x 4 root root 4096 Apr  7 22:58 accesslogs
    -rw-r--r-- 1 root root  150 Mar 29 20:43 index.html
    lrwxrwxrwx 1 root root   12 Apr 18 16:49 winshare -> /mnt/winshare
    drwxrwxrwx 2 root root 4096 Apr 18 15:45 test
    drwxr-xr-x 2 root root 4096 May 22 16:57 tmp
    [root@linuxserver html]# cd winshare
    [root@linuxserver winshare]# pwd
    /var/www/html/winshare
    [root@linuxserver winshare]# ll
    total 296748
    drwxrwxrwx 1 root root        0 Jun 30 09:44 2006
    -rwxrwSrwt 1 root root 15988881 Jun 30 10:34 2007_01_14_1030.mp3
    -rwxrwSrwt 1 root root 15302984 Jun 30 10:36 2007_01_28_1030.mp3
    -rwxrwSrwt 1 root root 18321772 Jun 30 10:37 2007_02_11_1030.mp3
    -rwxrwSrwt 1 root root 18321590 Jun 30 10:39 2007_02_18_1030.mp3
    -rwxrwSrwt 1 root root 17368904 Jun 30 10:41 2007_02_25_1030.mp3
    -rwxrwSrwt 1 root root 15744584 Jun 30 10:42 2007_03_04_1030.mp3
    -rwxrwSrwt 1 root root 14596790 Jun 30 10:44 2007_03_18_1030.mp3
    -rwxrwSrwt 1 root root 14405338 Jun 30 10:45 2007_03_25_1030.mp3
    -rwxrwSrwt 1 root root 13909027 Jun 30 10:46 2007_04_15_1030.mp3
    -rwxrwSrwt 1 root root 17189338 Jun 30 10:48 2007_04_22_1030.mp3
    I can also see the directory when I go to http://linuxserver/winshare (see attached screenshot). But binary files don't open... only ASCII files.

    I have tried mounting the \\winserver\winshare directly to /var/www/html/winshare and not using a link, but the behavior is the same.
    Attached Images Attached Images

  10. #10
    Just Joined!
    Join Date
    Jul 2007
    Posts
    1
    Try adding
    Code:
    EnableSendfile Off
    EnableMMAP Off
    inside in your Directory definition.

    It worked for me.

    For more details, see the Apache bugzilla
    Bug 42751 - CIFS mounted filesystems do not transmit files

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •