Results 1 to 10 of 99

Thread: HOWTO Ridiculously easy home file sharing with FTP and Zeroconf

Threaded View

  1. #1
    Join Date
    May 2006
    Beans
    115

    HOWTO Ridiculously easy home file sharing with FTP and Zeroconf

    The information in this thread has been moved to https://help.ubuntu.com/community/Ea...FTPAndZeroconf


    A thread for discussion of the wiki page only can be found here http://ubuntuforums.org/showthread.php?t=2012424

    Thread closed.

    This tutorial will cover setting up ridiculously easy, reliable, cross platform, standards based home networking. You will be able to share files from any Ubuntu/Debian system and connect to them from any Linux, Windows or OS X box. If you want to share your files on a firewalled home network but dont want to bother with Samba, NFS, or AFP this is for you.

    I chose FTP because it is supported on all systems since the beginning of time, it is secure enough for home use and its easy get working. Samba/SMB is too difficult to set up for the novice user, is Windows centric and has various problems with transfer failures and slowdowns. NFS was designed for Linux, but is, like Samba, too difficult for the novice user.

    I started out to do this with SSH, but decided on FTP after seeing GShare. I chose not use GShare for several reasons: it has a great many dependencies that my approach doesnt require, its FTP server was written from scratch and is therefore almost by definition more insecure and less interoperable than the FTP daemon we will use and I wanted to lock users into their home directories by default.

    Enough with the formalities, lets get to it.

    Setting up the FTP daemon

    We will use vsftpd (Very Secure FTP Daemon) as our FTP server.

    Install vsftpd

    Code:
    sudo apt-get install vsftpd
    Configuring vsftpd

    We need to modify some vsftpd settings. To edit your configuration file by hand, open the configuration file with

    Code:
    sudo gedit /etc/vsftpd.conf
    Change or uncomment (remove the #) the following parameters

    Code:
        local_enable=YES
        write_enable=YES
        anonymous_enable=NO
        chroot_local_user=YES
    Start vsftpd

    Code:
    sudo /etc/init.d/vsftpd restart
    Vsftpd will now always start automatically when your computer starts.

    Setting up Zeroconf

    Vsftpd will do the file transfer for us, but need some way to find services and name the boxes on our network. Avahi allows us to give our systems names without setting up a DNS server and easily discover services. It is a completely free Zeroconf daemon and the choice of Gnome.

    Install Avahi

    Code:
    sudo apt-get install avahi-daemon avahi-discover avahi-utils libnss-mdns service-discovery-applet mdns-scan
    If all you want is convenient host naming that allows you to use DNS names (ie. hostname.local) without setting up your own DNS server, you can skip the next section. Instructions are provided for connecting to shared files with and without zeroconf service announcements.

    Create Zeroconf Service Announcements (Optional)

    Most OSes zeroconf service discovery support, even zeroconf creator's OS X, is very limited. The potential of this technology is great, but for now this section is helpful but not critical.

    To edit by hand, run

    Code:
    sudo gedit /etc/avahi/services/ftp.service
    and paste

    Code:
        
        <?xml version="1.0" standalone='no'?>
        <!DOCTYPE service-group SYSTEM "avahi-service.dtd">
        <service-group>
        <name>FTP file sharing</name>
        <service>
        <type>_ftp._tcp</type>
        <port>21</port>
        </service>
        </service-group>
    Save an close Gedit.

    Restart Avahi

    Code:
    sudo /etc/init.d/avahi-daemon restart
    Repeat!

    Now do what you just did on every Ubuntu/Debian computer you wish to share files from. You only need to do the Install Avahi section on the Ubuntu/Debian systems that you want only to connect to shares from.

    Connecting to your shared files

    Connect from Ubuntu/Debian (or any Gnome desktop)

    With zeroconf service announcements

    Click Places->Network Servers. You should see an icon labeled FTP File Sharing. Right click on it and click Connect To This Server. You can give this link a new name or just click Connect.

    You should now see an icon labeled FTP File Sharing on your desktop. Double click the icon. You will be asked for your username and password: Select Connect as User. Enter your username and password *that you use to log into the box you are connecting to*. Check 'Remember password for this session.' After you click OK, your home directory on your remote machine should appear. You should not have to enter your username or password again until you log out of your computer.

    Without zeroconf service announcements

    Click Places->Connect to Server. Click the Service Type dropdown and select 'FTP (with login)'. Enter hostname.local in Server, in 'User Name' enter the username *that you use to log into the box you are connecting to*, and set 'Name to use for this connection' to FTP File Sharing.

    You should now see an icon labeled FTP File Sharing on your desktop. Double click the icon. Enter your password *that you use to log into the box you are connecting to* and check 'Remember password for this session'. After you click Connect, your home directory on your remote machine should appear. You should not have to enter your username or password again until you log out of your computer.

    Connect from OS X

    OS X natively supports connecting to FTP through the Finder. The only drawback is that mounted shares are read only.

    Without zeroconf service announcements

    Open Finder. Click Go > Connect to Server. Enter 'ftp://hostname.local' then click Connect. Enter your username, password and check 'Remember this password', then click OK. There will now be a new Finder entry for your ftp site.

    With zeroconf service announcements

    Open Safari. Press Option+Apple+B to open bookmarks. Click on the Bonjour icon. Find the name of the service you want to connect to and double click it.

    Connect from Windows

    Because Microsoft is backing its own zeroconf-ish protocol, Windows support for zeroconf service announcements is practically non-existant. Apple's Bonjour client is the only real free support for zeroconf on Windows. Its service browsing functions are extremely limited, but it works quite well for host naming. Because service discovery support is so limited, we will not use service discovery when connecting from Windows. Therefore, after installing Bonjour, you can use can use either of the following connection methods whether or not you created zeroconf service announcements.

    Install Bonjour

    Download Apple's Bonjour for Windows here. Run the setup like any other; answer Next, Yes and OK to every question. After your computer restarts, you will have full zeroconf naming support.

    With Explorer

    This method does not create a new drive letter; you will only be able to access files through Explorer.

    Open an Explorer window. Click Tools > Map Network Drive... Click the "Sign up for online storage or connect to a network server" hyperlink. Click Next on the Add Network Place wizard. Click the "Choose another network location" icon and click Next. Enter the host to connect to in the form ftp://hostname.local and click Next. Uncheck "Login anonymously" and fill in the username that you want to connect with then click Next. Change the name of the network place if you wish and click Next then click Finish.

    A window should open and you should be prompted for your password. Enter your password and check Save Password then click Log On. You should now see your files on the remote machine.

    With NetDrive

    Windows cannot mount FTP as a drive natively, but there is a program called NetDrive that does an excellent job. There is already a tutorial that is more complete than anything I could do so follow these instructions to install NetDrive and make one critical change: When you get to "add new site", enter the "Site Address/URL" in the form HOSTNAME.local, where HOSTNAME is the name of the box you are connecting to.

    Success!

    Thats about all there is to it.

    The major drawback to this setup is that most gui-less Linux applications will not be able to save and open files directly. Applications designed especially for Gnome will most likely work, but support is currently hit-and-miss. If you find that your application cannot directly access the share, you will need to manually copy the files, work on them, then copy them back.

    Conclusion

    IMHO, this completely blows away Samba/SMB and NFS for ease of setup, ease of use and cross platform interoperability (although we have not yet made use of this).

    Making our shared files act like part of our file system, and therefore work with any application, is possible and will be covered in a future tutorial. In the future I will add information about mounting FTP shares so that you may access files from any application as if there were on your system. I will also describe how to mount our FTP share on Windows and OSX for truly sublime cross platform file sharing.

    Origionally posted here

    Edit 2006/08/26: Made zeroconf service announcements optional. Added mounting instructions for OS X and Windows.
    Last edited by Elfy; June 29th, 2012 at 09:40 AM. Reason: Removed dead links

Bookmarks

Posting Permissions

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