Introduction: How to Make File Server Using Raspberry Pi
Now a days it is common to have multiple computers in one house with music and videos spread between them. Another way to organize your stuff is to keep it on a centralized server aka FILE SERVER.
In this instructables, we will create a file server using raspberry pi.
Let's get started.
Step 1: Video
Have a look at comprehensive video. If you like it, don't forget to subscribe.
Step 2: Components
For this miniProject we will need following components.
- Raspberry pi, preferably raspberry pi 3 for its built in wireless LAN,
- 5V USB power supply,
- microSD card and
- microSD card reader.
You will also need a laptop/desktop to setup raspberry pi.
Step 3: Getting Raspberry Pi Up and Running
First order of business is to get raspberry pi up and running. Following steps guides you to do exactly that.
- Download latest raspbian from raspberrypi.org,
- Insert microSD card in microSD card reader,
- Connect it to your home machine (laptop/desktop) and
- Install and open etcher to burn raspbian on microSD card.
Step 4: Enabling Remote Login to Raspberry Pi
Once raspbain is burnt to microSD card. Copy raspbian root directory address, open terminal on home machine, change directory to copied root directory address. Modify file named interfaces in etc/network directory to look like one shown in attached image. Once done, create an empty file named 'ssh' in raspbian boot directory. Finally takeout microSD card from card reader and insert it in raspberry pi. Following that turn on your raspberry pi.
Once Raspberry pi boots up find IP address of raspberry pi using network scanning application like angryIPScanner. Using obtained IP address you can remote login to raspberry pi with ssh from terminal in linux and software like putty in windows.
Step 5: SAMBA
Once you remote login to raspberry pi create a folder named Share that contains folder named 'Test_folder' in the home directory. We will use 'Test_folder' for file server demo.
Samba is the name of the software that lets you easily share files over network.
On raspberry pi we can install samba with-
sudo apt-get install samba samba-common-bin
Step 6: Configure SAMBA
Once SAMBA is installed we need to edit configuration file so it knows where to look for our 'Test_folder'. Open configuration file with
sudo nano /etc/samba/smb.conf
and to the bottom of this file add following settings.
[Pi share]
comment = Pi shared folder path = /home/pi/Share browseable = yes writeable = Yes only guest = no create mask = 0777 directory mask = 0777 public = yes guest ok = yes
Once done, save and exit.
Following this we need to reset SAMBA password using
sudo smbpasswd -a <username>
Finally restart SAMBA with
sudo /etc/init.d/samba restart
and we are done.
Step 7: Done
Now open up file browser on your home machine. Click on 'connect to server' on side menu and type
smb://<Raspi IP address>
You should see 'Test_folder' appearing.
That's it folks.
Thanks for reading.
7 Comments
Question 2 months ago on Step 2
Can you use a USB stick, if so is it the same process?
Question 4 years ago on Step 5
How would I access the server through windows?
Answer 3 years ago
run: mstsc
Reply 2 years ago
settings > apps > programs and features > Turn windows features on or off > SMB 1.0/CIFS File sharing support
Make sure the box is ticked then restart your computer. Then you can access it in windows explorer under "Network"
2 years ago
so this is server but small version?
Reply 2 years ago
can be as big as you like
2 years ago
You've added a samba user "sudo smbpasswd -a <username> "and then only specified guests in the config file. Although most of the config can be done by un-commenting the appropriate lines in the config file, you can add it to the bottom of the file like you did. Pi already 'owns' the home folder so masks should be set to 0755 for better security.
[Pi share]
comment = Pi shared folder
path = /home/pi
browseable = yes
writeable = Yes
create mask = 0755
directory mask = 0755
valid users = pi