Install and Setup SAMBA
SAMBA is a Windows file sharing system that runs on Linux, works flawlessly, and is easy to setup too. Let’s install SAMBA and then configure it with the following code:
sudo apt-get install samba samba-common-bin -y
After SAMBA finishes installing, let’s add user:pi and share password by entering the following code (enter a password at the prompts):
sudo smbpasswd -a pi
Which should produce the following result if successful:
pi@RASPINAS:~ $ sudo smbpasswd -a pi
New SMB password:
Retype new SMB password:
Added user pi.
Before we start altering the SAMBA config file, let’s make a backup:
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
Now let’s edit the smb.conf file:
sudo nano /etc/samba/smb.conf
Now scroll all the way down to the bottom of the file using your arrow key, then add the following code to create your NAS file share:
# NAS Share
path = /mnt
comment = RasPi NAS Share
valid users = pi
writeable = yes
browseable = yes
The save Ctrl+O and exit Ctrl+X. Now we need to make sure our changes work, so enter the following:
Which should product the following (if you want a full output, press Enter at the prompt):
pi@RASPINAS:~ $ testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
WARNING: The "syslog" option is deprecated
Processing section "[homes]"
Processing section "[printers]"
Processing section "[print$]"
Processing section "[NAS]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
If the line reads “Loaded services file OK.” then you’re good to go.
Finally, we need to restart the SAMBA service by entering the following command:
sudo /etc/init.d/samba restart
Connect to your NAS
Now we need to connect to your NAS share and make it automatically show up in your Network drive. Open File Explorer (Win8/10 search “File Explorer” and open top result) (WinXP/Vista go to Start > Computer), then click on the Network item on left-side window pane. Click inside the address bar, then type
\\RASPINAS (or whatever you chose for a hostname during Debian setup, if you’re unsure enter the following command
hostname) and hit Enter
You should now see your nas folder so click it on, then enter your username pi and password you entered when we setup SAMBA:
Now lets add the share as a network drive (optional) by opening File Explorer (Win8/10 search “File Explorer” and open top result) (WinXP/Vista go to Start > Computer) then on the top navigation bar click on “Map network drive” and enter
\\RASPINAS\nas (or whatever your hostname and folder share is) into the Folder text box, check the Reconnect at sign-in checkbox, then click OK and it should open the new drive in File Explorer.
Well I hope this guide has shown you some cool RasPi and Linux stuff and that you had fun 🙂 Something to think about is adding a USB hub to expand the drive number capacity instead of forking out big $$ for large capacity USB drives. You can also add normal 2.5" or 3.5" SATA drives via a USB adapter, see this article. If you have any questions or comments, leave them below.