To share files between Windows and Linux, install Samba on Ubuntu, configure a shared directory in /etc/samba/smb.conf, create a Samba password, and connect from Windows using the server's IP address. This guide covers the essential setup steps for Ubuntu server hosting environments. Whether you use USA hosting, a VPS, or dedicated server hosting, configure file permissions and firewall rules carefully, and restrict SMB access to trusted networks.
What Is Samba?
Samba is an open-source software suite that implements the SMB protocol, allowing Windows and Linux systems to share files and printers over a network. It is commonly used for centralized file storage, cross-platform collaboration, and network file sharing.
How to Install and Configure Samba on Ubuntu
Step 1: Install Samba
Connect to your Ubuntu server through SSH. If you need help connecting, see How to Connect to Linux Servers Remotely.
Update package information and install Samba:
sudo apt update
sudo apt install samba

Verify the installation:
whereis samba
Step 2: Create and Configure a Shared Directory
Create a directory for shared files. This example uses /home/administrator/sambashare:
sudo mkdir -p /home/administrator/sambashare
Open the Samba configuration file:
sudo nano /etc/samba/smb.conf
Add the following configuration at the end of the file:
[sambashare]
comment = Samba on Ubuntu
path = /home/administrator/sambashare
read only = no
browsable = yes
Save the file and exit the editor. Ensure the directory has appropriate ownership and permissions for the intended users. Avoid granting unrestricted access to sensitive files.
Restart Samba and validate the configuration:
sudo testparm
sudo systemctl restart smbd
sudo systemctl status smbd
If UFW is enabled, allow Samba traffic:
sudo ufw allow from <trusted-subnet> to any app SambaReplace <trusted-subnet> with your trusted network, such as 192.168.1.0/24. Confirm that the Samba application profile exists on your system. For internet-facing server hosting, do not expose SMB ports directly to the public internet.
Step 3: Create a Samba User
Samba authentication requires a valid Linux system account. If the account does not exist, create it first. Then set its Samba password:
sudo smbpasswd -a administratorReplace administrator with your actual Linux username.

Step 4: Connect from Windows
On Windows, open This PC → Map network drive.

Enter the following network path, replacing the example IP address with your Ubuntu server's IP:
\\192.168.1.100\sambashare
Select Connect using different credentials, click Finish, and enter your Samba username and password.

After authentication succeeds, you can access the shared directory from Windows.

Conclusion
Samba enables file sharing between Windows and Ubuntu by combining a configured SMB share, valid user credentials, and appropriate network access. For secure server hosting, verify directory permissions and limit SMB access to trusted networks. When choosing a hosting provider, consider network security and private connectivity options. A USA hosting provider may suit applications requiring US-based infrastructure, while the best USA hosting location depends on your users and network requirements.