FuguHub Your Personal File Sharing Solution

 

FuguHub

Manage Data Your Way

FuguHub for Raspberry Pi

The Raspberry Pi is a tiny (credit card size) computer that runs Linux. The non-profit Raspberry Pi Foundation provides two Raspberry Pi versions, one with and one without network capability. You will need the $35 version that includes an Ethernet jack for Internet access. You will also need one SD card and a USB power supply such as a USB phone charger. See raspberrypi.org for purchase information.

Installing or Upgrading FuguHub

The following text box contains all required commands for installing or upgrading FuguHub. Click the text box below, copy (CTRL-C), and paste into your SSH window.

The above is a concatenation of commands which downloads the installation script, makes the script executable, and then executes the script. The FuguHub server will be running once the installation or upgrade completes. The server will also start automatically when you power on the device.

Use a browser and navigate to your FuguHub server by typing the Raspberry Pi's IP address into the browser's address bar. You should see the main page in FuguHub. Carefully read the instructions and click the "Config-Wizard" link shown in the left menu. This link takes you to the FuguHub configuration wizard and Internet wizard. You cannot login before you have configured your FuguHub server. Note: you do not need to run the "Config-Wizard" if you are upgrading from an older version.

Configuring FuguHub

You must configure the FuguHub server after installing it. You can do this using the Midori browser installed on the Raspberry Pi or you can do it from your Windows, Mac, etc. -- i.e. your main computer.

  • Using the Raspberry Pi: Start Midori and type in the address http://localhost
  • Using your main computer: Start any browser and type in the address http://ip-addr, where ip-addr is the IP address assigned to your Raspberry Pi.

The FuguHub main page will show up in your browser and this page will redirect you to the configuration wizard since your server is not configured. You can start using the FuguHub server as soon as you have set a password. You should also complete the Internet configuration wizard if your server is behind a router. This will enable external users access to your server.

Managing FuguHub from the command line

The FuguHub installation script installs a daemon script in /etc/init.d/bdd. This script makes sure your FuguHub server starts automatically when you power on your Raspberry Pi.

You can stop,start, and restart FuguHub from the command line as follows:

pi@raspberrypi ~ $ sudo service bdd stop
pi@raspberrypi ~ $ sudo service bdd start
pi@raspberrypi ~ $ sudo service bdd restart

The Linux user bd

The FuguHub server runs as the user 'bd'. This Linux user does not have access to anything outside of its /home/bd directory unless you make specific changes to allow such access.

You can become the user 'bd' by typing the following in a command window:

pi@raspberrypi ~ $ sudo su bd
bd@raspberrypi /home/pi $

The user 'bd' does not have a password and you must therefore login as root and then from root, login as user bd. The above command 'sudo su' makes the 'su' command execute as root. The user root can become any other user on Linux without a password so the command 'su bd' changes the root user to 'bd'.

Using FuguHub as a Network Attached Storage (NAS) device

One of the more popular FuguHub plugins is the Web File Server, which includes a WebDAV server and a Web File Manager. You automatically use the Web File Manager when using a browser and the WebDAV server when using a WebDAV client.

WebDAV is a type of network drive that can be securely accessed over the Internet. Check out the video to the right
if you are new to WebDAV.

The SD card you are using has more than likely insufficient storage space when using your Raspberry Pi as a NAS. You may want to plugin an external USB drive to increase the amount of data that you can store on your Raspberry Pi. The question is, how can FuguHub, which runs as the Linux user 'bd', access this USB drive? We will look at two methods for how the FuguHub server can access your external USB drive.

Using a VFAT formatted USB drive

Most USB drives are pre-formatted as VFAT which is not really a good fit for your Linux powered Raspberry Pi since VFAT cannot store Linux file permission information. We will later look into how to reformat the drive using a Linux file system.

Your Raspberry Pi will auto mount your external VFAT USB drive and the default settings will not allow the 'bd' user access to this drive. The following commands show how to fix this problem:

pi@raspberrypi ~ $ sudo umount /dev/sda1 #umount the auto mounted USB drive
pi@raspberrypi ~ $ sudo mkdir /mnt/usb1 #Create a directory we can use as a mount point
pi@raspberrypi ~ $ sudo mount -t vfat /dev/sda1 /mnt/usb1 -o umask=000 #mount the drive

The above mount command sets the umask to 000, which makes the file permissions 777 on your USB VFAT file system. These permissions make it possible for your FuguHub server to access this drive.

The root directory for the FuguHub Web File Server is /home/bd/disk. This directory can be accessed as http://ip-addr/fs/ using a browser. What we want to do is to make the USB drive accessible via the Web File Manager. An easy way to do this is to create a soft link in the disk directory as follows:

pi@raspberrypi ~ $ sudo su bd # Change to user bd
bd@raspberrypi /home/pi $ cd /home/bd/disk/
bd@raspberrypi ~/disk $ ln -s /mnt/usb1 usb1 #create soft link

The root of the mounted USB drive can now be access as http://ip-addr/fs/usb1/ using a browser. What's great about this solution is that you can now access your SD card and the new USB drive via the Web File Server.

Making the USB drive permanently mounted

Manually remounting the USB drive every time you reboot your Raspberry Pi becomes tedious. You can make the mount permanent by editing the /etc/fstab file. Open the fstab file as follows:

pi@raspberrypi ~ $ sudo nano /etc/fstab

Scroll to the end of the file and paste in the following:

/dev/sda1 /mnt/usb1 vfat umask=000 0 0

Save the file and reboot to test. The drive should mount automatically when you reboot your Raspberry Pi.

Reformatting the drive

We mentioned above that a VFAT file system is not ideal since we cannot set Linux permissions on this drive. In addition, a Linux file system is more resilient to disk errors than a VFAT file system. Another limitation with VFAT is that you cannot store files larger than 4Gbytes. The only benefit in using a VFAT file system is that you can plug it into a Windows computer. If you decide to reformat the drive, you can no longer access the USB drive directly from a Windows computer. However, you can mount the Raspberry Pi from your Windows/Mac/Linux computer using WebDAV and use it as a NAS.

Unmount the USB drive and format as follows:

pi@raspberrypi ~ $ sudo umount  /mnt/usb1
pi@raspberrypi ~ $ sudo mkfs.ext3 /dev/sda1

We can now mount the new formatted drive as follows:

pi@raspberrypi ~ $ sudo mount /dev/sda1 /mnt/usb1

When we used the VFAT file system, we made a soft link that accessed the root of the USB drive. We will do it a little bit different now since we have a Linux file system. Instead of accessing the root, we will create a new directory on the USB drive and set the proper permissions for the 'bd' user.

pi@raspberrypi ~ $ sudo mkdir /mnt/usb1/bd
pi@raspberrypi ~ $ sudo chown bd:daemon /mnt/usb1/bd

The user 'bd' can now access the 'bd' directory on the USB drive. The next step is to fix the soft link we created in the BD disk directory:

pi@raspberrypi ~ $ sudo su bd
bd@raspberrypi /home/pi $ cd /home/bd/disk/
bd@raspberrypi ~/disk $ rm usb1
bd@raspberrypi ~/disk $ ln -s /mnt/usb1/bd usb1

The only thing missing now is to fix the fstab file. We are no longer mounting the drive as VFAT so go ahead and open the fstab file as follows:

pi@raspberrypi ~ $ sudo nano /etc/fstab

Scroll to the end of the file and change the line:

/dev/sda1 /mnt/usb1 vfat umask=000 0 0

to the following:

/dev/sda1 /mnt/usb1 ext3 defaults 0 0

Save the file and reboot to test. The drive should mount automatically when you reboot your Raspberry Pi.

Info for Computer Hobbyists

There is a lot of cool stuff you can do with FuguHub as it is, but you may want to read up on the developer section if you are a computer programmer. FuguHub is an application server letting you write your own scripts to perform; for example, home automation, remote management, and more. With FuguHub, you can write your own web based user interface to control any type of hardware that is connected to a Raspberry Pi such as the readily available Raspberry Pi expansion boards.