Samba is an open-source software suite that provides seamless file and print services to SMB/CIFS clients. It allows a server to share files, printers, and other resources with clients on a network, typically Microsoft Windows-based systems, in a way that is transparent to both the client and server. Samba uses the TCP/IP protocol and supports cross-platform file and printer sharing between Windows, macOS, and Linux systems.
To ensure that a Raspberry Pi is up to date, open a terminal window on the Raspberry Pi and run the below command to update and upgrade any outdated packages to their latest version.
sudo apt update -y
sudo apt upgrade -y
It could take some time to complete depending on the number of packages that need to be updated.
Now install samba
and samba-common-bin
packages on the Raspberry Pi:
sudo apt install -y samba samba-common-bin
Create a new user for using with samba or you can even use the existing user:
sudo useradd <username>
Set a password for the user:
sudo smbpasswd -a <username>
Create a new shared folder and set appropriate permissions:
sudo mkdir /share
sudo chown: <username> /share
Edit the Samba configuration file /etc/samba/smb.conf
and add the following lines to the file to create a new share:
[share]
comment = Shared folder
path = /share
writeable = yes
follow symlinks = yes
wide links = yes
Restart the Samba service:
sudo systemctl restart smbd
Now, you should be able to access the shared folder from other devices on your network.