This project sets up a Linux-based file server using Samba, allowing file sharing across a network. Samba enables Linux systems to communicate with Windows systems using the SMB/CIFS protocol.
- A Linux machine (e.g., Ubuntu) with root or sudo access.
- Basic knowledge of the Linux command line.
Run the following commands to install Samba:
# Update the package list
sudo apt update
sudo apt install samba
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
sudo nano /etc/samba/smb.conf
[Shared] path = /srv/samba/shared browseable = yes writable = yes guest ok = no read only = no create mask = 0644 directory mask = 0755
sudo mkdir -p /srv/samba/shared
sudo chmod 2775 /srv/samba/shared
sudo chown nobody:nogroup /srv/samba/shared
sudo adduser sambauser
sudo smbpasswd -a sambauser
#Set Directory Ownership and Permissions
sudo chown sambauser:sambauser /srv/samba/shared
sudo chmod 2775 /srv/samba/shared
#Restart the Samba Service:
sudo systemctl restart smbd
#Verify Samba Status:
sudo systemctl status smbd
##From Another Linux Machine: #Use smbclient to access the shared directory:
smbclient //server-ip/Shared -U sambauser
#Replace 'server-ip' with the IP address of your Samba server ##From a Windows Machine: #Open File Explorer and enter the server’s IP address:
\\server-ip\Shared
###8. Automate Samba Service on Startup ##Enable Samba to Start on Boot:
sudo systemctl enable smbd