top of page

How I Built a Secure, Cost-Effective File Server Using CentOS and Samba

  • Jul 24, 2025
  • 3 min read

Updated: Aug 11, 2025

Introduction

In many organizations, secure file storage comes with high licensing costs and dependency on domain infrastructure. My challenge was to design a solution that ensured full data security, complete audit trails, and zero licensing costs—all without a domain setup. This post details how I achieved it using CentOS Linux, Samba, and a research-driven approach.

System Overview



A simple architecture diagram showing:

  • CentOS file server in the center

  • Connected clients on the right

  • Audit log module tracking all file operations

  • Backup destination (optional)

  • Secure access controls in place

Why CentOS and Samba?

CentOS Linux offers stability, enterprise-grade security, and is free to use. Samba enables cross-platform file sharing with granular control. Together, they allowed me to build a robust, scalable, and low-maintenance system.

The Research Process

Before implementation, I conducted targeted research:

  • Explored open-source alternatives to paid domain-based file servers.

  • Evaluated Samba’s full_audit module for tracking every file operation.

  • Reviewed community forums, GitHub discussions, and Samba documentation to refine configuration options.

This research phase was key—by systematically testing configurations in a controlled environment, I avoided costly trial-and-error during production deployment.

Implementation Highlights

  • Server Setup: Installed CentOS Linux and configured network parameters.

  • Samba Installation: Set up shares with precise permissions per department.

  • Audit Logging: Enabled full_audit to log every file read, write, and delete operation.

  • Security Measures: Integrated with firewall rules and restricted access by IP.

  • Backup Policy: Linked to an offsite backup target using rsync.

    Sample Audit Log Entry:

[2025/02/10 15:24:13.120000, 2] full_audit: connect to [Finance] as user=finance_mgr
[2025/02/10 15:25:41.083000, 2] full_audit: open file /reports/Q1_2025.xlsx

This format allows quick traceability of file actions, meeting compliance and security requirements.

System Requirements

  • Hardware: 1 server machine (with at least 8 GB RAM and a decent CPU)

  • Operating System: CentOS 6 or 7

  • Software: Samba, auditd, nano/vim text editor

  • Client Machines: Windows PCs (mostly using Home Edition, not Professional)

Step-by-Step Deployment Guide

  1. Install CentOS

    • Download CentOS ISO and install it on the server hardware.

    • Perform basic setup (hostname, static IP, root password).

  2. Install Samba

sudo yum install samba samba-common samba-client
  1. Configure Shared Folders with IP-based Restrictions

    • First, configure DHCP reservations for each client using MAC addresses.

    • Then, set up the Samba configuration file (/etc/samba/smb.conf) to restrict access per IP address.

[accounts]
	path = /srv/accounts
	valid users = @accounts
	hosts allow = 192.168.1.10
	read only = no
  1. Enable Samba Auditing

    • Add audit module to smb.conf:

vfs objects = full_audit
full_audit:prefix = %u|%I|%m|%S
full_audit:success = open, unlink, rename
full_audit:failure = none
full_audit:facility = LOCAL7
full_audit:priority = NOTICE

Add audit module to smb.conf:

  1. Restart Samba Services

systemctl restart smb
systemctl restart nmb

Understanding the Audit Logs Once implemented, the audit log records every file activity like this:

zuhaib|192.168.1.10|PC1|accounts|open file.txt

This helped us trace who accessed, copied, deleted, or renamed files—with timestamps and source IP.

Impact & Benefits

  • Zero Licensing Cost: Entire solution based on open-source stack.

  • Complete Traceability: Every file access logged for security audits.

  • Performance Gains: Faster response times compared to prior shared drives.

  • Operational Security: Controlled access reduced accidental or malicious file changes.

  • Scalability: Easily expandable to additional departments or offices.

Challenges & Solutions

  • Challenge: Samba audit logs were initially too verbose.

    Solution: Filtered specific operations to avoid log bloat while retaining essential tracking.

  • Challenge: Training staff to use secure file access.

    Solution: Delivered step-by-step guides and held training sessions.

Final Recommendations

This project not only demonstrated the value of open-source innovation but also reinforced the importance of applying methodical research to deliver secure, cost-effective infrastructure. The solution became a practical reference for later deployments in cross-border, high-security environments, including defense research operations.

Knowledge-Sharing Call-to-Action

I share this implementation so that small and medium-sized organizations—especially those constrained by licensing budgets—can confidently deploy secure, auditable file storage without costly infrastructure.

If you have questions or want to adapt this for your own environment, feel free to reach out via my website.

36 Comments


Fabulous alternate to the expensive windows server solutions. Saving the guide to make it my upcoming project. Indeed I really liked the concept you mentioned about its auditing logs feature.

Like

Good information and clear steps. This will help many IT professionals.

Like

rashamsharma22
Dec 20, 2025

Nice work. Thank you for the step by step guide.

Like
Replying to

Thank you for the kind feedback. I am glad to know you found the steps helpful, and I am available to help if you face any difficulties.

Like

hamza yousaf
hamza yousaf
Dec 17, 2025

Very informative post. It looks like the solution I’ve been looking for to replace my existing Windows Server–based file server. My most important requirement is to create shared folders that are secured and accessible only to the relevant users or departments. After reading the instructions you provided, this approach seems feasible. Before getting started, I would appreciate any advice or precautions from your side to ensure everything is properly aligned.

Like
Replying to

That’s a fair question, and it comes up quite often.

While it is technically possible to run a Samba file server and Kaspersky Endpoint Security/Management on the same machine, I would strongly advise against it unless you have solid hands-on experience and are fully aware that this becomes an experimental setup.

Both services are resource-intensive and business-critical. Combining a data server with a centralized security server increases risk - performance issues, file locking, misconfiguration, or a single failure can affect everything at once. This is especially risky if Linux administration and service tuning are still new to you.

If you don’t already have strong Linux, Samba, and endpoint security expertise, the safest and recommended approach is to keep these services on separate…

Like

st.jonesp9
Dec 08, 2025

Great technical breakdown. The step-by-step approach really helps beginners and professionals alike.

Like
Mohammad Zuhaib
Mohammad Zuhaib
Dec 19, 2025
Replying to

Thank you! I’m glad to know that you found the step-by-step approach helpful for both beginners and professionals. Appreciate the feedback.

Like
ChatGPT Image Jul 29, 2025, 11_29_51 AM.png

For professional inquiries, collaborations, or consulting opportunities:
✉️ mohammad@zuhaib.co.uk
🌐 www.zuhaib.co.uk

Quick Links

Connect With Me

  • LinkedIn

© 2025 by Mohammad Zuhaib.

All rights reserved.

bottom of page