Samba Server on RTD1261

General info

Samba is an implementation of number of services and protocols, like:

  • NetBIOS over TCP/IP (NBT)
  • SMB
  • CIFS (an enhanced version of SMB)
  • MSRPC the Network Neighborhood suite of protocols
  • A WINS server also known as a NetBIOS Name Server (NBNS)
  • the NT Domain suite of protocols which includes NT Domain Logons
  • Secure Accounts Manager (SAM) database
  • Local Security Authority (LSA) service, NT-style printing service (SPOOLSS)
  • NTLM and more recently Active Directory Logon which involves a modified version of Kerberos and a modified version of LDAP.

All these services and protocols are frequently incorrectly referred to as just NetBIOS and/or SMB. Samba can see and share printers.
Samba sets up network shares for chosen Unix directories (including all contained subdirectories). These appear to Microsoft Windows users as normal Windows folders accessible via the network. Unix users can either mount the shares directly as part of their file structure or, alternatively, can use a utility, smbclient (libsmb) installed with Samba to read the shares with a similar interface to a standard command line FTP program. Each directory can have different access privileges overlaid on top of the normal Unix file protections. For example: home directories would have read/write access for all known users, allowing each to access their own files. However they would still not have access to the files of others unless that permission would normally exist. Note that the netlogon share, typically distributed as a read only share from /etc/samba/netlogon, is the logon directory for user logon scripts.
Configuration is achieved by editing a single file (typically installed as /etc/smb.conf or /etc/samba/smb.conf). Samba can also provide user logon scripts (a shell script is a script written for the shell, or command line interpreter, of an operating system) and group policy implementation through poledit

Implement SAMBA on the Movie Cube-R or Emprex ME1 with auto start functionality.

  1. Install the Debian image as given on this wiki web pages
  2. Install the SAMBA server as indicated on this page
  3. Add / modify some scripts to allow start the SAMBA server each time the Movie Cube/ME1 is powered.

To perform the modifications one should use the Telnet session or the PuTTy

Assume that the Debian image is stored on the Hardisk partition 1 (part1). To chroot into the Debian image the following needs to be done.

First start a telnet session and login into the Movie Cube -R/ME1 (default user is root with no pass)
The # in front of each command is just to show where the prompt is and shouldn't be typed as the system will just ignore the command.

# cd /usr/local/etc/hdd/volumes/HDD1/ Change to the directory location where the image is stored
# mkdir chroot Create a directory chroot
# tune2fs -j ./debin-4g.ext2 Change debian filesystem to ext3 (needed in latest firmware version)
# mount -o loop -w ./debin-4g.ext2 ./chroot mount the image to the directory entry Debian.
# chroot ./chroot After this command you will enter the Debian environment.
# mount -t proc proc /proc Mount /proc for device access

Now the hard disk need to be found to where it is assigned to

# fdisk -l

This will result in something like:

Disk /dev/hdb: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hdb1 2 34049 273490560 b W95 FAT32
/dev/hdb2 34050 35097 8418060 83 Linux
/dev/hdb3 35098 38857 30202200 83 Linux
/dev/hdb4 38858 38909 417690 5 Extended
/dev/hdb5 38859 38878 160650 82 Linux swap / Solaris
/dev/hdb6 38880 38899 160650 83 Linux

So the fat32 partition is /dev/hdb1, in your situation it could be hda1, whatever yours is whenever /dev/hdb1 is mentioned replace it with the appropriate letter.

# mkdir /mnt/hdb
# mount -t vfat /dev/hdb1 /mnt/hdb

In the mount command there you need to specify the file system type where you can choose:

  • vfat which specify FAT16/FAT32 (will normally be this one as in my example)
  • ntfs which specify NTFS (Doubt NTFS is implemented but it may be in the future)

My drive is listed as FAT32 to I will use vfat.

# apt-get update

When this has finished it is possible that some error messages will appear, on mine I just ignored them, its not really important for what we are doing.

# apt-get install samba

Answer all questions asked during the installation with the defaults settings, it doesn’t matter as after the completion of the installation the config file will be adapted manually.

# rm /etc/samba/smb.conf remove the original configuration file
# nano /etc/samba/smb.conf start the text editor which is available in the Debian environment however it isn't available in the base linux version

The following needs to be past into the nano window.

workgroup = workgroup Change the workgroup to whatever your windows workgroup is
netbios name = VideoNAS You can change this to what you like, its the PC name you will see on the network
server string = video-server
include = /etc/samba/dhcp.conf
dns proxy = no
log file = /var/log/samba/log.%m
max log size = 50 syslog = 0
guest account = root
security = share
encrypt passwords = false
hide unreadable = yes
[VideoNAS HDD]
comment = NAS Video Share
path = /mnt/hdb
read only = no
public = yes
veto files = /chroot/debin-4g.ext2/

press ctrl+o and ctrl+x to save and exit.

Now restart the samba daemon and see if the share works:

# /etc/init.d/samba restart

Wait a few minutes and with a bit of a luck you should see the VideoNAS on your windows network and within that you should see your Video share folder
Now its time to setup the auto boot script.
First we need to add the drive info to the fstab (file system table) to make it easier to mount:

# nano /etc/fstab

Paste the following line at the end of the file:

/dev/hdb1 /mnt/hdb vfat defaults 0 0 Obviously change /dev/hdb1 if it is different from the above regarding the location where the HDD is found

Below the script to need to be prepared and stored as:

sleep 30
mount -o loop -w /usr/local/etc/hdd/volumes/HDD1/debin-4g.ext2 /usr/local/etc/hdd/volumes/HDD1/chroot
chroot /usr/local/etc/hdd/volumes/HDD1/chroot umount /proc
chroot /usr/local/etc/hdd/volumes/HDD1/chroot umount /mnt/hdb
chroot /usr/local/etc/hdd/volumes/HDD1/chroot mount -t proc proc /proc
chroot /usr/local/etc/hdd/volumes/HDD1/chroot mount /mnt/hdb
chroot /usr/local/etc/hdd/volumes/HDD1/chroot /etc/init.d/samba start

Saved this into the samba share at the root. Via a telnet session it will be manipulated to put it at the correct location.

Now leave the Debian session and enter into the plain Movie Cube-R/ME1 system

# exit

The prompt that will appear would be something like:

/usr/local/etc/hdd/volumes/HDD1 #

Then move the script to the directory /usr/local/etc directory with the following command

# mv /usr/local/etc/

and make it executable

# cd /usr/local/etc
# chmod aog+x

and finally add that to the initialization script (rcS)

# vi rcS

vi is quite a hard to learn text editor but is the only one available on the Movie Cube-R/ME1 system, luckily not a lot to be done.

  1. press 'i' on your keyboard to enter insert mode
  2. scroll to the bottom with the down arrow key and paste the following line:
sh /usr/local/etc/ &

#press escape to exit insert mode and type :wq and press enter to save and quit.

Now the setup is complete, time to test it out so type:


To reboot the system, in a few minutes the samba server will be running and you should be able to see all your videos as if it were a NAS drive.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License