Accessing network shares via your BarracudaDrive Windows Service

Accessing other computers via FuguHub’s WebDAV or Web File Manager plugin can be very useful since you can use your FuguHub as a secure remote file service for your LAN. In other words, use FuguHub as a gateway to remotely access one or several computers on your network.

Drive letters listed as virtual directories

On Windows, FuguHub creates a virtual top directory that lists all the drives visible to the server. These drives can also be network drives -- that is, other computers.

Network shares are per user

In Windows, network shares are per user. By default, the FuguHub server runs as a Windows service using the user "System". The "System" is the LocalSystem account.

Since shares are per user, the shares available to you are not available to the user "System" or any other user on your computer. Each user must setup their own network shares.

The bdinit.cmd command file

FuguHub, when run as a service, can execute a Windows command file at startup. The command file must be named "bdinit.cmd" and be located in the FuguHub installation directory. Any command in this file is executed by the FuguHub service when it starts. This file is typically used for setting up a network share for the FuguHub service at startup.

The Windows "net use" command

In Windows, a network share is setup by using the "net use" command. For example, the following command maps the network share \\myserver\cdrive to any available drive letter.

net use * \\myserver\cdrive

Where the name "myserver" is a PC on your LAN and "cdrive" is an exported drive/folder on this computer.

The above command can be added to "bdinit.cmd" command file by using a text editor such as notepad. The above "net use" command will be executed the next time the FuguHub service is restarted.

Commands run via the bdinit.cmd command file cannot be interactive. For example, the net use command will fail if the user needs to authenticate and the password is not provided. The net use command above must contain the user and password for the remote share to prevent the "net use" command to interactively ask for the credentials.

net use * \\myserver\cdrive mypassword /USER:myusername

Where "myusername" and "mypassword" is the name and password for a user that is allowed to access the network share.

Changing the user for the FuguHub service.

We mentioned above that the FuguHub service runs as the user "System" by default. The LocalSystem is a privileged account locally, but this account has no network privileges. This means that the above "net use" command will fail unless you change the user for the FuguHub service.

You can either create a new Windows user for FuguHub or use your own user ID. The user ID must have a password. If your user ID does not have a password or you have no users in your Windows computer, a new user must be created.

When you have a User ID with a password:

  1. Open Control Panel -> Performance and Maintenance -> Administrative Tools.
  2. Start the Services Management Console by double clicking on Services.
  3. Scroll down until you see the FuguHub ( bd ) service.
  4. Right click FuguHub and select properties.
  5. Click the "Log On" tab.
  6. The Local System account is enabled by default. Change this setting to "This account".
  7. Click Browse to open the "Select User" dialog.
  8. Enter the Windows user name and click "Check".
  9. Click OK when the name is confirmed.
  10. The user name should now be filled in on "Log On" tab.
  11. Enter the password for the user and click OK.
  12. In the Services list, make sure FuguHub is selected, and press the restart link.

 The FuguHub server should now restart and run with the selected user ID. If you created a "bdinit.cmd" command file with one or several "net use" command(s), the new network drive(s) should now be accessible by the server. On the computer where the server is running, open a browser window and enter URL http://localhost/drive/. The network drive(s) you mapped by using the "net use" command in the "bdinit.cmd" command file should now be visible in your browser window.
 

The backup plan

A good knowledge in Windows administration is necessary for the FuguHub service to gain access to network shares. If you are unable to follow the above tutorial and make network shares available to the FuguHub service, follow this alternative tutorial:

When you power on you computer, FuguHub runs as a Windows service. You can change this setting and run FuguHub in console mode. When FuguHub runs in console mode, the server is running using the same user ID as the currently active user and the server has access to all shares available to the active user.

  1. Right click the FuguHub icon in the task bar and stop the service.
  2. Right click the FuguHub icon again and click console mode.

The FuguHub server now runs in console mode with your user ID and has access to all network shares you have access to.

Posted in Tutorials Wednesday, January 30th, 2008