If you need a reliable way to share files between Linux and Windows clients, setting up a Samba file server on VPS is a simple method using the SMB/CIFS protocol. Samba transforms your Linux server into a network file server that works with Windows, macOS, and other Linux systems, which makes it ideal for centralized storage solutions.
In this guide, you will learn to build a lightweight Samba file server on a High Storage VPS, configure a secure share, and verify access from typical clients.
Prerequisites to Build a Samba File Server on VPS
Before setting up your Samba file server on VPS, ensure you have the necessary environment ready with a reliable hosting provider like PerLod Hosting.
A High Storage VPS with root or sudo access.
Basic command-line knowledge.
Network access for client connections.
Once you are done, proceed to the following steps to install and configure the Samba file server on the Linux VPS.
1. Install Samba on Linux VPS
The Samba package is available in the default Linux repositories. To install the Samba file server, run the system update and use the commands below based on your Linux distro to install it.
Note: If semanage is not found, install it with the commands below:
Bash
sudodnfinstallpolicycoreutils-python-utils-y
2. Configure Samba File Share on Linux VPS
At this point, you must configure the Samba daemon to define how resources are shared across the network. The main configuration file, located at /etc/samba/smb.conf, controls security settings, workgroups, and share definitions for your Samba file server on VPS.
In this step, you can back up the original config and add a custom share block to enable client access.
Back up the original configuration file with the command below:
Now that the service is active and the firewall is configured, your Samba file server on VPS is ready to accept connections. In this step, you can connect to the shared directory from a client machine to verify that permissions are working correctly on your High Storage VPS.
From Windows:
Open File Explorer.
In the address bar, enter: \your-vps-ip\share
Enter username: sambauser and the password you set.
To map as a network drive, right-click the share and select "Map network drive".
server min protocol = SMB3 enforces modern encryption protocols.
hosts allow restricts access to specific networks.
Restart Samba after any configuration changes:
Bash
sudosystemctlrestartsmbdnmbd
Your Samba file server on VPS is now operational and ready for production use on your High Storage VPS.
Conclusion
At this point, you have built a secure Samba file server on VPS for file sharing between Linux and Windows. This setup gives you full control over your private data without third-party limits. For the best performance and scalability, we recommend deploying on a High Storage VPS.
We hope you enjoy it. Subscribe to our X and Facebook channels to get the latest updates and articles.
Samba Connection issues are usually caused by firewalls blocking ports 139 and 445. Check the firewall rules on your VPS and ensure your hosting provider allows this traffic.
Samba uses a separate password database from your system users. To update a password, just run sudo smbpasswd user_name.
Yes, you can restrict access by adding the hosts allow directive to your /etc/samba/smb.conf file.
We use cookies to run PerLod and to understand how the site is used. You can accept everything, or open Manage to turn individual categories off. Cookie policy.