In 1991 Australian Mr. Andrew Tridgell wanted to allow DOS machines and UNIX machine to share files. In order to accomplish this he wrote the SMB protocol software on UNIX systems. After some period of time it was officially renamed Samba. Samba was finally beginning to have great success attracting a number of people with lofty ideals. Today Samba has become synonymous with the UNIX SMB/CIFS protocols. The main objective when developing SAMBA initially was to allow Windows to access UNIX systems using the My Network Places on Windows machines. This allowed Windows users to access the shared folders and files from UNIX systems. Other operating systems has also ported this software allowing this interoperability.
If you have computers with other operating systems, there is most likely a version of SAMBA that can be installed on them. Once you do that you can use your Raspberry Pi as your own personal cloud and share all of your files with all of your computers including tablets and smartphones. You can also use your Raspberry Pi as a file backup server. The potential uses are only limited by your imagination. You can also set up a decentralized 24-7 DFS storage services through the "book - GlusterFS ".
Experimental hardware devices:
This experiment requires the following hardware:
- Raspberry Pi board.
- USB External hard drive (optional).
This experiment requires the following software:
Make sure the Raspberry Pi is connected to the network and has a fixed IP address.
Step 1: Using a USB External Hard Drive With Your Raspberry Pi
In many cases SD capacity is not enough. Luckily
Raspberry Pi can easily be connected to external USB hard drives. Follow the steps in this section, and you will soon have a lot more storage connected to your Raspberry Pi.
Because I've written this tutorial article, see Using a USB external hard drive with your Raspberry Pi
Step 2: Formatting the Hard Disk
In many cases the FAT32 format commonly used in the Linux environment for compatibility will Windows system will be a cause of problems and distress. So in this project we will show you how to use one of the native Linux formats to format your USB external hard drive. The format we will be using is called ext3 and is a common native Linux format type.
Please connect your USB external hard drive to the Raspberry Pi and make sure that is powered by an external power source.
Reusing your old hard drives
You probably have a lot of old hard drives that you are no longer using and you might like to use them with your Raspberry Pi. Most likely they are formatted for use with Windows using NTFS or maybe FAT32. So for best performance you might want to partition the format using a native Linux format. Before proceeding, make sure that you have backed up any data on the hard drives as this procedure will wipe out any existing data. You can verify whether or not the Raspberry Pi recognized the existing hard drive by executing the following command.
$ sudo fdisk -l | grep '^Disk'
Step 3: Obtain a Hard Disk Format.
Through the following instructions can confirm Raspberry Pi has to recognize the hard drive, you can be confirmed through the hard drive name and the size of your hard drive, make sure your hard drive Device Boot, the following picture shows an example, the hard disk is on the / dev / sda1
$ sudo blkid
Come through the system that is now formatted as FAT32 vfat format your hard drive, but if you want the hard drive can be provided to the page, then use Apache, you need to convert ext3 file format.
Step 4: Umount HDD
Next we want to format the hard disk format ext3
format, make sure your hard drive data has been backed up, and avoid errors, please put the other being the first to pull away from the hard drive or turn off the machine Raspberry Pi, and through the following instructions confirm that you want to format the hard drive has umount, and follow your actual situation of the / dev / sda1 adjusted Device Boot name of the actual machine.
＄sudo umount /dev/sda1
If the following error message appears, displaying the hard disk is now being said that the other software use can, through the parameter lowercase L, to force quit.
＄sudo umount -l /dev/sda1
Step 5: Formatting the Hard Disk Ext3
Please format the hard disk through the following instructions.
＄sudo mkfs.ext3 /dev/sda1
Once complete, you can through the following instructions
$ sudo blkid
Step 6: Installation of Remote File System
Next we need to install the samba software. Execute the following instruction to do so.
$ sudo apt-get install samba
Step 7: Create Users
For security purposes you should require each user that needs to access your Raspberry Pi samba system to use a userid. So our next action will be to create a samba userid by executing the following command. You will need to change powenko to your username preference. As you can see in Figure 5-15 you will be asked to supply a password and other information. Most of this is optional except for the password of course.
$ sudo adduser powenko
Step 8: in Sambar Plus User
Now that we have created our new user accounts you need to tell samba about them. For each user that you created with the adduser command you will need to execute the following commands to add them to samba.
$ sudo usermod -a -G sambashare powenko $ sudo pdbedit -a -u powenko
Step 9: Establish a Shared Archive
You can use either the SD card or an external hard drive to share your date so once you have made that decision you will create a folder called allusers that will provide a directory that you can use to share data between users. In our example below, we will be using an external hard drive to hold the shared directory. So the command will use /home/allusers and external hard drive path /media/usbhdd referring back to our installation procedures for installing an external hard drive. Execute the following commands to accomplish this.
$sudo mkdir /home/allusers $sudo chown root:sambashare /home/allusers
$sudo chmod 770 /home/allusers/
$sudo chmod g+s /home/allusers/
Step 10: Configuring Samba Settings
Next we need to modify the samba settings by editing the smb.conf file using the nano editor. You can accomplish that by executing the following command.
$ sudo nano /etc/samba/smb.conf
In the nano editor search for the text string “security = user” and if there is an # on the first column remove it as in the example shown in Figure 5-18.
# security = user
Change it to :
security = user
The shared home directories are read/write by
default. This should be changed to read only for security reasons. So still editing the smf.conf file in the nano editor search for the text string “read only = yes” and then modify it to “read only = no” as in Figure under the Share Definitions heading.
read only = yes
read only = no
And while you are still editing the smb.conf file,
add the following lines can be the end of the file if you want. The purpose is to share the file path /home/ allusers, so that each person can have access to this path to allow them to share files with the others users of this server. Once all the updates are complete don't forget to save your changes by pressing Ctrl + O and then exit the nano editor by pressing Ctrl + X .
create mask =0770
directory mask =0770
Step 11: Restart Samba
For all the changes to take affect you need to restart samba which can be accomplished by executing the following command.
$ sudo /etc/init.d/samba restart
Step 12: Connecting Your Mac to the Raspberry Pi File Server.
Through the Mac Finder, select raspberry pie under Shared options which uses the sum: //raspberrypi/powenko
When the connection dialog appears make sure that Connect as registered users is selected. In the Name and Password fields use the Username and password that we previously established when configuring Samba. In this example the Name is powenko.
Step 13: Connecting You Windows PC to the Raspberry Pi File Server.
windows PC User:
On your Windows PC you can use file explorer to My Network Places to select the Raspberry Pi file server it should look similar to this \\raspberrypi\powenko the powenko name would be whatever name you established previously. If you still can not find the Raspberry Pi server through My Network Places, you can also use the IE browser to access the raspberry pi's IP location and user name. For example in figure 5-21 we have entered \\ 192.168.0.111\powenko in IE's address bar.
After sucesfully connecting you can upload and download data. You can use the mouse to drag and drop, pull the folder to the Windows desktop to create a shortcut.
Step 14: Linux File Server Connection to Raspberry Pi
On Linux use the X-window file explorer to select the smb://raspberrypi/powenko file share.
If you set up a different user name don't forget to change powenko to the user name that you established.
Step 15: Connect IOS to Your Raspberry Pi File Server.
You can also use iOS and Android's browser to access the Raspberry Pi File Server. In iOS the samba APP FileExplorer is available to easily allow you to connect to your Raspberry Pi file server..
Step 16: Connect Android to the Raspberry Pi.
On the Android platform you can install the AndSMB APP to allow you to easily connect to your Raspberry Pi file server.
To find the App go to Google play and search for AndSMB and you will find this free software.
Step 17: 5.3.6 Connect Raspbain to Your Raspberry Pi File Server.
you have multiple Raspberry Pi's you can connect to your Raspberry Pi file server from them as well. From accessories select File Manger to open the graphical File Manager application. In the Address bar enter smb://raspberrypi/powenko changing powenko as appropriate.
Participated in the
Raspberry Pi Contest