Discussion of this wiki can be found here

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 don't 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.

Setting up the FTP daemon

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

Install vsftpd

sudo apt-get install vsftpd

1. Configuring vsftpd

We need to modify some vsftpd settings. (Users of Ubuntu 12.4 will find that this method needs amending, The amending is fairly simple. in the vsftpd.conf file -do NOT uncomment the "#chroot_local_user=YES" line. -immediately after that line add "local_root=/home/{name}/Public" where {name} is the name on the user's home folder and "Public" can either be the Public folder installed by default in Ubuntu or any other subfolder you want... it just cannot be the home folder. (vsftp does not want you connecting with write privileges directly to the home folder)

Also, you'll find it is not necessary to load Avahi at all. In the Nautilus file manager window you can go to the 'File" menu and click 'connect to server' and enter the proper information. Once you connect, "Bookmark" the connection and it will not only always be there in the Nautilus side pane, but you can also go the directly from the Unity Launcher by right clicking on the folder icon, then on the bookmarked link.)

To edit your configuration file by hand, open the configuration file with

gksudo gedit /etc/vsftpd.conf

Change or uncomment (remove the #) the following parameters

    local_enable=YES
    write_enable=YES
    anonymous_enable=NO
    chroot_local_user=YES

2. Start vsftpd

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

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

gksudo gedit /etc/avahi/services/ftp.service

and paste

    <?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 and close Gedit.

Restart Avahi

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 that you can download from here that does an excellent job. 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. Edit 2006/08/26: Made zeroconf service announcements optional. Added mounting instructions for OS X and Windows.

Originally posted The Ubuntu Forums (ubuntuforums.org)

EasyHomeFileSharingWithFTPAndZeroconf (last edited 2012-07-18 10:54:35 by elfy)