Having debian installed on the dockstar is quite nice but how about access to the data in there? In this article I will explain how you easily set up a data-storage with autofs, hd-idle, samba and proftpd.
I assume you have debian squeeze running on a usb stick and your data you want to share on your network is stored on an external hard-drive.

1. autofs and hd-idle

In order to mount the hdd as it is connected to a certain mountpoint we will install autofs and to reduce its power-consumption we let it spin down after some minutes with hd-idle. The default repository doesn’t contain hd-idle so dev-eth0.de created a repo for the dockstar. You may want to add it to your /etc/apt/sources.list by adding the line deb http://repo.dev-eth0.de/ squeeze main.

If you want to make sure, that this repository isn’t faked, you can add the gpg key to your apt-key:

wget http://repo.dev-eth0.de/repo.key
apt-key add repo.key

Now install those packages:

apt-get update
apt-get install autofs hd-idle

1.1 autofs

I want to mount my external drives in /media so I added this line to /etc/auto.master:

/media    /etc/auto.media --timeout=10 --ghost

This sets /media as the parent folder for all mounts in /etc/auto.media, so create auto.media and add the devices you want to mount. You can use sdxX or the uuid (find out with blkid) as the device:

disk1    -fstype=ext3,users    UUID="ddf4386d-a9cb-4b98-9d6f-46e90190xxxx"

Your hdd will be mounted as /media/disk1.

1.2 hd-idle

Spinning down all attached hdds: First of all enable hd-idle in /etc/default/hd-idle:

# start hd-idle automatically?
# spin down after 300 sec and write logfile
HD_IDLE_OPTS="-i 300 -l /var/log/hd-idle.log"

Thats it, just restart the service.

2. samba

You want to have windows-shares on your local network? I will explain how you set up password protected shares because I don’t want all of my friends in my WLAN have access to it 😉

apt-get install samba samba-common samba-common-bin

Take a look at /etc/samba/smb.conf and customize it for your needs, these are those lines I have edited:

# some global vars I edited:
   workgroup = WORKGROUP
   wins support = yes
   security = user
   unix password sync = yes

# my shares:
   comment = Home Directories
   browseable = no
   read only = no
   writeable = yes
   create mask = 0700
   directory mask = 0700
   valid users = %S

   comment = All Printers
   browseable = yes
   path = /var/spool/samba
   printable = yes
   guest ok = no
   read only = yes
   create mask = 0700

   comment = all mounted hdds
   path = /media
   browseable = yes
   ;veto files = /ftp_share/ #to hide dirs
   #to hide dirs another way, try which fits for you
   hide files = /desktop.ini/Desktop.ini/DESKTOP.INI/$RECYCLE.BIN/Thumbs.db/thumbs.db/THUMBS.DB/
   writeable = yes
   create mask = 0777
   directory mask = 0777

Once you have set this up you are ready to create the users, note they have to be unix users already:

smbpasswd -a user1 # add user
smbpasswd -e user1 # enable user

If you now log in as user1 and run smbpasswd again you will update the samba and system password. Finally restart samba and try the connection!

3. proftpd

Sometimes I have the problem not be at home when I need certain files stored on my dockstar. I either could connect to it with VPN or simply use FTP (note: insecure file-transfer). I chose proftpd because it’s easy to configure, install it by typing:

apt-get install proftpd

It will ask if you want to install it with inetd or standalone, choose standalone.
The default configuration fits pretty well for my needs, the only thing I enabled was VirtualRoot. As I login I am in jail in my home dir, the module gives me the ability to get out there. There you have to edit two files:

vim /etc/proftpd/proftpd.conf

# Useful to keep VirtualHost/VirtualRoot directives separated
Include /etc/proftpd/virtuals.conf
vim /etc/proftpd/virtuals.conf

<ifmodule mod_vroot.c>
  VRootEngine on
  DefaultRoot ~
  VRootAlias ftp_share /path/to/ftp_share

This makes every ftp-user able to access the ftp_share directory. For more security information check out http://www.proftpd.org/docs/faq/linked/faq-ch6.html

4. Reference