Chapter 10:

FILE SERVER

Set up a centralized file server on your network for easy and secure file access from any device. This setup uses the Samba protocol, a standard for sharing files across different operating systems.

  1. Creating a Storage Directory: Start by creating and setting the permissions for your storage directory:

    sudo mkdir /home/pi/Storage

    sudo chmod 777 -R /home/pi/Storage

    sudo chown pi -R /home/pi/Storage

  2. Installing and Configuring Samba: Install Samba, a software that enables file sharing across different systems:

    sudo apt-get install samba -y

    Then, edit the Samba configuration file:

    sudo nano /etc/samba/smb.conf

    Add or modify the following sections in the configuration file:

    [global]

    netbios name = server

    server string = server

    workgroup = WORKGROUP

    security = user

    [NAServer]

    comment = NAServer

    path = "/home/pi/Storage"

    public = yes

    guest ok = yes

    read only = no

    Note: Ensure the path is set to your newly created storage directory.

  3. Setting Up User Access: Create a Samba user linked to your Raspberry Pi account:

    sudo pdbedit -a -u pi

    You will be prompted to create a password for this Samba user.

  4. Restarting Samba Service: Apply the changes by restarting the Samba daemon:

    sudo service smbd restart

  5. Accessing the File Server: Your files are now accessible from any device on the network. Use the following address in a File Explorer:

    smb://[Raspberry Pi's IP address]

    Replace [Raspberry Pi's IP address] with the actual IP address of your Raspberry Pi.

This setup turns your Raspberry Pi into a powerful file server, allowing for convenient and flexible access to your files from various devices within your network. The Samba protocol ensures compatibility across different operating systems, making it a versatile solution for home or small office networks.