- April 19, 2023
- 10:18 pm
- No Comments
How to Set Up a Basic Samba Server on Linux
Samba is a popular open-source software suite that provides seamless file and print services to SMB/CIFS clients, such as Windows and macOS systems. By setting up a Samba server on your Linux machine, you can share files and folders across your network with various operating systems. In this guide, we will show you how to set up a basic Samba server on your Linux system.
Steps
Step 1: Open Terminal
Open the terminal by pressing Ctrl + Alt + T on your keyboard or by searching for it in the applications menu.
Step 2: Install Samba
On Debian/Ubuntu-based systems:
sudo apt update && sudo apt install samba
On Fedora/RPM-based systems:
sudo dnf update && sudo dnf install samba
Step 3: Create Shared Directory
Create a directory that you want to share on your network:
sudo mkdir /srv/samba/shared_folder
Replace shared_folder with the desired folder name.
To set the appropriate permissions, use the following commands:
sudo chown -R nobody:nogroup /srv/samba/shared_folder && sudo chmod -R 0775 /srv/samba/shared_folder
Step 4: Configure Samba
To configure Samba, edit the main configuration file:
sudo nano /etc/samba/smb.conf
This example uses nano. You can use the text editor of your choice.
Add the following lines at the end of the file, replacing shared_folder and Share Description with the appropriate folder name and description:
[shared_folder]
path = /srv/samba/shared_folder
browsable = yes
guest ok = yes
read only = no
create mask = 0775
directory mask = 0775
force user = nobody
force group = nogroup
comment = Share Description
Save the file and exit the text editor.
Step 5: Restart Samba Services
After making changes to the Samba configuration, restart the Samba services:
On Debian/Ubuntu-based systems:
sudo systemctl restart smbd && sudo systemctl restart nmbd
On Fedora/RPM-based systems:
sudo systemctl restart smb && sudo systemctl restart nmb
Step 6: Enable Samba Services at Startup
To ensure that Samba services start automatically at boot, enable them with the following commands:
On Debian/Ubuntu-based systems:
sudo systemctl enable smbd && sudo systemctl enable nmbd
On Fedora/RPM-based systems:
sudo systemctl enable smb && sudo systemctl enable nmb
Step 7: Access Shared Folder
From a Windows system, open File Explorer and enter the following address in the address bar:
\\your_server_ip\shared_folder
Replace your_server_ip with your Linux server’s IP address and shared_folder with the folder name you specified in the Samba configuration.
From a macOS system, open Finder, click on Go in the menu bar, and select Connect to Server. Enter the following address:
smb://your_server_ip/shared_folder
Conclusion
By following this guide, you have successfully set up a basic Samba server on your Linux system, allowing you to share files and folders across your network with various operating systems. This setup can help you improve file sharing and collaboration within your home or office network.
Please Leave Feedback and Corrections in the Comments
More to Explore
MALIBAL Aon S1 Vs Apple MacBook Pro 13 (M2)
In the competitive landscape of high-performance, thin & light laptops, the MALIBAL Aon S1 and the Apple MacBook Pro 13 (M2) are noteworthy contenders.
How to Set Up and Use a Basic Firewall on Linux
UFW (Uncomplicated Firewall) is a user-friendly front-end for managing iptables firewall rules on Linux systems.
How to Set Up a VPN Server on Linux
A VPN (Virtual Private Network) provides a secure, encrypted connection between your devices and the internet.
How to Install and Use a Terminal Multiplexer on Linux
A terminal multiplexer is a powerful command-line utility that enables users to manage multiple terminal sessions.
How to Create and Manage Users and Groups on Linux
User and group management is an essential aspect of maintaining a secure and organized Linux system.
How to Install and Configure a LAMP Stack on Linux
A LAMP stack is a popular software bundle consisting of Linux, Apache, MySQL, and PHP, used for hosting and deploying web applications.
How to Set Up and Use SSH Key Authentication on Linux
Secure Shell (SSH) is a widely used protocol for secure remote access and management of Linux servers.
How to Create and Manage Cron Jobs on Linux
Cron jobs are a feature on Linux that enables users to automate repetitive tasks by scheduling scripts or commands to run at specific intervals.
What is Kubernetes?
Kubernetes is an open-source container orchestration platform that automates the management of containerized applications.