Find the answer to your Linux question:
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 22
Heres the scenario. I'm setting up an FTP server that will allow users access to directories across my drive. In Windows' IIS I'd do that by creating an alias. How ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined! wraith's Avatar
    Join Date
    Apr 2005
    Location
    Sault Ste. Marie, Canada
    Posts
    54

    Virtual Directory for FTP


    Heres the scenario. I'm setting up an FTP server that will allow users access to directories across my drive. In Windows' IIS I'd do that by creating an alias. How do i do that in Linux?

    Im using vsftpd on suse 9.1..
    The dir i want to expose is /windows/ but the ftp server is located at /srv/ftp/.

    I tried creating a symlink in /srv/ftp/. I can see the link when I access the ftp server thru IE on my laptop but when I try to open the folder i get a '550 Failed to change directory' error.

    Any ideas

  2. #2
    Linux Guru kkubasik's Avatar
    Join Date
    Mar 2004
    Location
    Lat: 39:03:51N Lon: 77:14:37W
    Posts
    2,396
    There should be an option in your vsftpd.conf that allows you to change the folder for anonymous, all the authenticated folers will be the users /home/ directory. Your other bet is to change the user vsftpd's $HOME varaible to /windows/
    Avoid the Gates of Hell. Use Linux
    A Penny for your Thoughts

    Formerly Known as qub333

  3. #3
    Linux Newbie
    Join Date
    Mar 2005
    Posts
    230
    Question, are you trying to give a ftp user access to a directory other than the home directory, or are you trying to create a virtual directory within the user's home directory that points elsewhere on the filesystem? If the former, you can use virtual users. If the latter, you can use the "mount --bind" command.

  4. #4
    Just Joined! wraith's Avatar
    Join Date
    Apr 2005
    Location
    Sault Ste. Marie, Canada
    Posts
    54
    Quote Originally Posted by SilentRage
    Question, are you trying to give a ftp user access to a directory other than the home directory, or are you trying to create a virtual directory within the user's home directory that points elsewhere on the filesystem? If the former, you can use virtual users. If the latter, you can use the "mount --bind" command.
    Hmm.. Im a lil confused..
    This is an anon. access FTP server. So no users really. Only Read no Write.
    Its basically for me to share my files with my friends who'll be using IE to browse the server. This is the structure I'm aiming for.

    /srv/ftp/
    |___ Audio ( pointing to /Windows/Audio/)
    |___ Neuro ( pointing to /Windows/Neuro/)
    |___ Psyco ( pointing to /Windows/Psyco)

    The above 3 foldes are tooo big ('round 10+ GB each) to copy to the /srv/ftp/ folder. So, the only option is to have some kinda link or something to point to the folders.

    Im guessing that I'll need the latter in ur solution. The mout --bind option is what I should be looking at. But.. what does it do? (Im quite the noob!)

  5. #5
    Linux Newbie
    Join Date
    Mar 2005
    Posts
    230
    It would be easier to just make your anonymous ftp root /Windows. Is this acceptable? I will tell you how if you prefer that option.

  6. #6
    Just Joined! wraith's Avatar
    Join Date
    Apr 2005
    Location
    Sault Ste. Marie, Canada
    Posts
    54
    Quote Originally Posted by SilentRage
    It would be easier to just make your anonymous ftp root /Windows. Is this acceptable? I will tell you how if you prefer that option.
    Hmm.. Sure.. thats sounds OK.. but i would love to know how to share a directory that isnt under the ftp root..

  7. #7
    Linux Newbie
    Join Date
    Mar 2005
    Posts
    230
    Well, since you're reluctant, and all my testing doesn't indicate that there's any danger here, I'll tell ya how to do it. I'm assuming you want the entire /Windows directory accessible by ftp .

    mkdir /srv/ftp/windows
    mount --bind /Windows /srv/ftp/windows

    The reason the symlink didn't work is cause you're probably using chroot (and should be using chroot). After chroot'ing to /var/ftp, vsftpd does not have access to the /Windows directory anymore. The symbolic link would point to an invalid location. However, by doing a mount --bind, you make 2 paths in the file system access the same content. One directory is not merely pointing to another directory, they actually become one and the same. This kind of "bind"ing of directories is a low enough level that chroot is effectively fooled into accessing content orginally only available outside of its reach.

    I still think it's better if you just move the entire thing.
    mv /Windows /srv/ftp

  8. #8
    Just Joined! wraith's Avatar
    Join Date
    Apr 2005
    Location
    Sault Ste. Marie, Canada
    Posts
    54
    I tried the mount --bind /Windows/ /srv/ftp/windows/

    When I tried to navigate using the SUSE filemanager and when i tried IE from my XP machine, I can get to the windows folder and see the 4 folders inside it but when I open any of the folders its blank..

    Dont know if this matters but each of the 4 folders are 4 windows (3 NTFS & 1 FAT) partition thats been mounted.

    Any Ideas??

  9. #9
    Just Joined!
    Join Date
    Aug 2004
    Location
    SLC, UT
    Posts
    67
    mount --bind /Windows /srv/ftp/windows

    should go the other way

    mount --bind /srv/ftp/windows/ /Windows/

    so it is

    mount --bind /I/Want/To/See/This/ /Here/

  10. #10
    Linux Guru kkubasik's Avatar
    Join Date
    Mar 2004
    Location
    Lat: 39:03:51N Lon: 77:14:37W
    Posts
    2,396
    im not familar with mount -bind (although I am intruiged should this pan out) the 2 guesses I have would be to

    1)check for some -R or -recursive flag (while this seems to make mininal sense as it seems that you are actualy adding a link in the directory tree to a similar inode and the tree should continue fine from there.. but who knows)

    2)permissions, its possible that this -bind has bypassed read permissions on the directory for your vsftp user, yet because of this you can jump to the directory anyways. perhaps something like

    chmod a+r /Windows

    but im just guessing here, so this is more to help point someone who really knows about the -bind flag in the right direction.
    Avoid the Gates of Hell. Use Linux
    A Penny for your Thoughts

    Formerly Known as qub333

Page 1 of 3 1 2 3 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
  •