Myth BOX
The home of guides for Myth TV, IPTables, and other linux based phenomena.
 
HD version
Preamble
Home
News
Spec
General guides
Partitioning
Installation
Firewall
Channel setup
Home automation
Product overview
Other
Useful links
SD version
Preamble
Functionality
Hardware
Software
Screenshots
Gallery
General guides
DVB Card
Myth TV
Broadband modem
Wireless network
Firewall
Network shares
Network IDS
Extra security
Streaming
Gensplash
EPIA specific guides
TV-Out cables
Audio/USB cables
Backplate
Wireless network
EPIA Kernel
Openchrome drivers
Surround sound
VPN
Online store
Prebuilt mythbox
Other
Useful links

Samba - Setting up the fileshare

  1. First things first, add samba to your USE flags in /etc/make.conf. Then emerge samba.
  2. Now copy the example configuration to the live configuration file using:
    cd /etc/samba/
    gunzip smb.conf.example.gz
    cp smb.conf.example smb.conf
    
    We can now edit this smb.conf file to suit our needs.
  3. Change the workgroup name to your workgroup name previously specified, and change map to guest to the value never.
  4. Under hosts allow, you should add the IP addressees of any clients on your network, the box's own IP, and the loopback IP of the box (with only the first octal, i.e. 127. only). This will allow only these IP addresses access to the samba shares. For added security, add hosts deny = 0.0.0.0/0.
  5. Ensure that encrypt passwords is set to yes.
  6. Now to edit the share definitions. Under [homes], change the code to take the following form:
    [<share_folder_name_in_path_below>]
       comment = Home Directories
       path = <path_to_share>
       valid users = <user1> <user2>
       browseable = yes
       writeable = yes
       public = no
    
  7. Finally, comment out any references to printer sharing (we won't be using this on the box).
  8. Now in order to be able to add a samba user so that they can have access to the shares on the box, they must first have a user account on the box itself. So do useradd -G users -s /bin/false -p <new_password> <username>. This should be done for all of the users which will be connected via samba.
  9. Next we need to add samba accounts using smbpasswd. First ensure that the following directory exists: /etc/samba/private/. Now execute the following command for each user in the system: smbpasswd -a <username>. You will then be prompted for a password. Make sure that the usernames for samba and the box itself match, otherwise this operation will fail.
  10. According to the gentoo samba how to, it is worth changing the hosts line in /etc/nsswitch.conf to:
    hosts: files dns wins
    
    so that NetBIOS can easily find Windows systems.
  11. Samba should now be ready to start, so type: /etc/init.d/samba start.
  12. To test if we can get a connection to the file store, emerge samba on the client and run smbclient //<box_machine_name>/<share_folder_name> -U <username>. Use this just like an ftp connection, and try to download and upload files to test that it works.
  13. Now we can make the samba share accessible as a network folder using mount. However, we first need to ensure that the kernel supports the samba filesystem, so check and recompile your kernel as necessary with the following option selected:
    File systems -->
        Network File Systems -->
            SMB file system support (to mount Windows shares etc.)
    
  14. Boot with this new kernel (if necessary) and create the directory /mnt/mythbox/. Then use the following to mount the samba share:
    mount -t smbfs -o username=<username>,password=<password> //<hostname>/<share_folder_name> /mnt/mythbox/
    
  15. Make samba start upon boot using: rc-update add samba default.
  16. Job done!

Troubleshooting:
  • I get messages in the log file saying that samba cannot change to the shared directory, or that the shared directory doesn't exist!
    Ensure that the directory that you want to share has the permissions set correctly. The directory should belong to the group users and the directory should be readable/writable/executable by this group. Also, all the parent directories up the tree also need these access rights.

Alternatively - setting up an FTP daemon

After using samba, I have found that it can be a little flakey when transfering large files over. Hence, you may choose to use samba for streaming MP3's, while opting for FTP to transfer video files. Here's how.
  1. emerge proftpd.
  2. Copy the configuration file /etc/proftpd/proftpd.conf.sample to /etc/proftpd/proftpd.conf.
  3. Login using your normal mythtv username and password!