
<div>
<p>This guide will teach you to complete <strong>Samba File Sharing Setup on Ubuntu 24.04 Noble Numbat</strong> step-by-step. Samba file sharing on Ubuntu 24.04 allows seamless file and printer sharing between Linux and Windows systems. It enables secure, cross-platform collaboration in home and business networks. Setting up **Samba File Sharing Setup on Ubuntu 24.04** correctly is crucial for smooth network operations.</p>
<p>Samba packages are available by default in the Ubuntu 24.04 APT repository. You can now proceed to the guide steps below on the <strong><a href="https://bluehoster.info/">Orcacore</a></strong> website to install and configure Samba file sharing on Ubuntu 24.04.</p>
<h2 id="steps-to-install-and-configure-samba-file-sharing-on-ubuntu-24-04">Steps To Install and Configure Samba File Sharing on Ubuntu 24.04</h2>
<p>To install Samba on Ubuntu 24.04, log in to your Ubuntu server as a non-root user with sudo privileges. For this purpose, you can check the following guides:</p>
<p><strong><a href="https://bluehoster.info/create-a-sudo-user-on-ubuntu-2404/">Create a user with sudo privileges on Ubuntu 24.04</a></strong></p>
<p>Once you are done, follow the steps below to complete your Samba setup on Ubuntu 24.04.</p>
<p>Also, you can look for the Video Tutorial Here:</p>
<figure><p>
<iframe title="How to Install and Configure Samba File Share on Ubuntu 24.04 | Step-by-Step Guide" width="1290" height="726" src="https://www.youtube.com/embed/9xlGc_wY0n8?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</p></figure>
<p>First, you need to run the system update with the following command:</p>
<pre><code>sudo apt update</code></pre>
<p>Then, you can easily use the APT package manager to install Samba. To do this, you can run the command below:</p>
<pre><code>sudo apt install samba smbclient cifs-utils -y</code></pre>
<p>The above command will install required packages and dependencies for Samba File sharing on Ubuntu 24.04. Once your installation is completed, verify it by checking your Samba version:</p>
<pre><code>samba --version</code></pre>
<pre><code><strong><mark>Output</mark></strong>
Version 4.19.5-Ubuntu</code></pre>
<p>Now you can proceed to the next steps to start your Samba File Sharing Configuration on Ubuntu 24.04. Ensuring a successful **Samba File Sharing Setup on Ubuntu 24.04** involves meticulous configuration.</p>
<p>At this point, we want to modify the Samba global settings in the Samba config file. You can modify it in the Samba configuration file at the <strong><mark>/etc/samba/smb.conf</mark></strong> directory. Open the file with your desired text editor like <strong><a href="https://bluehoster.info/how-to-work-with-the-vi-editor-in-linux/">Vi Editor</a></strong> or <strong><a href="https://bluehoster.info/work-with-nano-editor/">Nano Editor</a></strong>:</p>
<pre><code>sudo vi /etc/samba/smb.conf</code></pre>
<p>At the file look for the <strong>Global section</strong>, and find the <strong>workgroup</strong> line and make sure it is set to <strong>WORKGROUP</strong>. It should look like this:</p>
<figure><img decoding="async" width="817" height="238" src="https://bluehoster.info/wp-content/uploads/2025/03/samba1.webp" alt="Samba File Share Global Settings" srcset="https://bluehoster.info/wp-content/uploads/2025/03/samba1.webp 817w, https://bluehoster.info/wp-content/uploads/2025/03/samba1-300x87.webp 300w, https://bluehoster.info/wp-content/uploads/2025/03/samba1-768x224.webp 768w" sizes="(max-width: 817px) 100vw, 817px"></figure>
<p>Once you are done, close the file.</p>
<h3 id="3-creating-samba-shared-directories">3. Creating Samba Shared Directories</h3>
<p>Now you must create your <strong>Samba shared directories on Ubuntu 24.04</strong>, including <strong>Public</strong> and <strong>Private</strong>. To do this, run the following commands:</p>
<pre><code># sudo mkdir /public
# sudo mkdir /private</code></pre>
<p>Then, you must add the Samba shared directors with their authentication methods to the Samba configuration file. For this purpose, open the Samba config file again and add the following shared directories to the end of the file:</p>
<pre><code>sudo vi /etc/samba/smb.conf</code></pre>
<pre><code>[public]
comment = Public Folder
path = /public
writable = yes
guest ok = yes
guest only = yes
force create mode = 775
force directory mode = 775
[private]
comment = Private Folder
path = /private
writable = yes
guest ok = no
valid users = @smbshare
force create mode = 770
force directory mode = 770
inherit permissions = yes</code></pre>
<p>It should look like this:</p>
<figure><img decoding="async" width="805" height="475" src="https://bluehoster.info/wp-content/uploads/2025/03/samba2.webp" alt="Creating Samba Shared Directories" srcset="https://bluehoster.info/wp-content/uploads/2025/03/samba2.webp 805w, https://bluehoster.info/wp-content/uploads/2025/03/samba2-300x177.webp 300w, https://bluehoster.info/wp-content/uploads/2025/03/samba2-768x453.webp 768w" sizes="(max-width: 805px) 100vw, 805px"></figure>
<p>Once you are done, save and close the file.</p>
<p>In this step, you must create a Samba share user group to access the Private and Public shared as specified in the config file above. To create the Samba group on Ubuntu 24.04, run the command below:</p>
<pre><code>sudo groupadd <mark><strong>smbshare</strong></mark></code></pre>
<p>Then, you must set the correct permissions for Samba group access to shared directories:</p>
<pre><code># sudo chgrp -R smbshare /private/
# sudo chgrp -R smbshare /public</code></pre>
<p>Also, set the correct permissions for the Samba shared directories:</p>
<pre><code># sudo chmod 2770 /private/
# sudo chmod 2775 /public</code></pre>
<p><strong><em>Note</em></strong>: The <strong>value 2</strong> at the beginning of the above commands, stands for the <strong>SGID</strong> bit. This allows newly created files to inherit the parent group.</p>
<p>Now you should create a <strong>no-login local user</strong> to access the shared directories by using the command below:</p>
<pre><code>sudo useradd -M -s /sbin/nologin <strong><mark>sambauser</mark></strong></code></pre>
<p><br>Then, add the user to the Samba share group on Ubuntu 24.04 with the following command:</p>
<pre><code>sudo usermod -aG <mark><strong>smbshare</strong></mark> <strong><mark>sambauser</mark></strong></code></pre>
<p>Also, you need to set a password for your Samba user with the command below:</p>
<pre><code>sudo smbpasswd -a <strong><mark>sambauser</mark></strong></code></pre>
<figure><img loading="lazy" decoding="async" width="705" height="93" src="https://bluehoster.info/wp-content/uploads/2025/03/samba3.webp" alt="set a password for your Samba user" srcset="https://bluehoster.info/wp-content/uploads/2025/03/samba3.webp 705w, https://bluehoster.info/wp-content/uploads/2025/03/samba3-300x40.webp 300w" sizes="auto, (max-width: 705px) 100vw, 705px"></figure>
<p>Finally, enable the created account by using the following command:</p>
<pre><code>sudo smbpasswd -e <strong><mark>sambauser</mark></strong></code></pre>
<pre><code><strong><mark>Output</mark></strong>
Enabled user sambauser.</code></pre>
<p>Once you are done, you can now test your Samba File Sharing Configuration on Ubuntu 24.04 by using the command below:</p>
<pre><code>sudo testparm</code></pre>
<p>Press <strong>Enter</strong> to see your Samba configuration is set up correctly:</p>
<figure><img loading="lazy" decoding="async" width="1010" height="797" src="https://bluehoster.info/wp-content/uploads/2025/03/samba4.webp" alt="Test and Verify Samba File Sharing Configuration on Ubuntu 24.04" srcset="https://bluehoster.info/wp-content/uploads/2025/03/samba4.webp 1010w, https://bluehoster.info/wp-content/uploads/2025/03/samba4-300x237.webp 300w, https://bluehoster.info/wp-content/uploads/2025/03/samba4-768x606.webp 768w" sizes="auto, (max-width: 1010px) 100vw, 1010px"></figure>
<h3 id="5-create-samba-sample-files">5. Create Samba Sample Files </h3>
<p>At this point, we want to show you how to create demo files and access them from the local machine, Windows client, and Linux client. To create a sample file, you can run the commands below:</p>
<pre><code># sudo mkdir /private/<mark>demo-private</mark> /public/<mark>demo-public</mark>
# sudo touch /private/<mark>demo1.txt</mark> /public/<mark>demo2.txt</mark></code></pre>
<p>Then, restart Samba file sharing on Ubuntu 24.04 to apply the changes:</p>
<pre><code>sudo systemctl restart nmbd</code></pre>
<p>Also, you can check the Smaba service status with the command below:</p>
<pre><code>sudo systemctl status nmbd</code></pre>
<figure><img loading="lazy" decoding="async" width="803" height="286" src="https://bluehoster.info/wp-content/uploads/2025/03/samba5.webp" alt="Smaba service status" srcset="https://bluehoster.info/wp-content/uploads/2025/03/samba5.webp 803w, https://bluehoster.info/wp-content/uploads/2025/03/samba5-300x107.webp 300w, https://bluehoster.info/wp-content/uploads/2025/03/samba5-768x274.webp 768w" sizes="auto, (max-width: 803px) 100vw, 803px"></figure>
<p><strong><em>Note</em></strong>: If you have a firewall running, you need to allow remote access from the specified IP range as shown below:</p>
<pre><code>sudo ufw allow from <mark>192.168.205.0/24</mark> to any app Samba</code></pre>
<p>In this step, you can check and access your Samba share files from your local machine. To do this, run the command below with:</p>
<pre><code>smbclient '\localhostprivate' -U <strong><mark>sambauser</mark></strong></code></pre>
<p>Enter your <strong>Samba user password</strong>, you will access the Samba command line, then enter the <strong>ls</strong> command to check your Samba demo files:</p>
<figure><img loading="lazy" decoding="async" width="803" height="217" src="https://bluehoster.info/wp-content/uploads/2025/03/samba6.webp" alt="Access Samba File Share From the Local Machine" srcset="https://bluehoster.info/wp-content/uploads/2025/03/samba6.webp 803w, https://bluehoster.info/wp-content/uploads/2025/03/samba6-300x81.webp 300w, https://bluehoster.info/wp-content/uploads/2025/03/samba6-768x208.webp 768w" sizes="auto, (max-width: 803px) 100vw, 803px"></figure>
<p>You can type <strong>exit</strong> to close the Samba shell.</p>
<h3 id="7-access-samba-shared-folders-from-a-windows-client">7. Access Samba Shared Folders From a Windows Client</h3>
<p>If you want to access your share files from your Windows client, you can follow the steps below. </p>
<p>First, you need to open a run box using <strong>Win+R</strong> and enter your <strong>Ubuntu 24.04 IP address</strong> in the box and click <strong>Ok</strong>:</p>
<figure><img loading="lazy" decoding="async" width="406" height="210" src="https://bluehoster.info/wp-content/uploads/2023/01/samba-1.webp" alt="Access Samba File Shares From a Windows Client" srcset="https://bluehoster.info/wp-content/uploads/2023/01/samba-1.webp 406w, https://bluehoster.info/wp-content/uploads/2023/01/samba-1-300x155.webp 300w, https://bluehoster.info/wp-content/uploads/2023/01/samba-1-150x78.webp 150w" sizes="auto, (max-width: 406px) 100vw, 406px"></figure>
<p>Then, the Samba shared folders on Ubuntu 24.04 should appear as below:</p>
<figure><img loading="lazy" decoding="async" width="530" height="186" src="https://bluehoster.info/wp-content/uploads/2023/01/samba-2.webp" alt="Samba shared folders " srcset="https://bluehoster.info/wp-content/uploads/2023/01/samba-2.webp 530w, https://bluehoster.info/wp-content/uploads/2023/01/samba-2-300x105.webp 300w, https://bluehoster.info/wp-content/uploads/2023/01/samba-2-150x53.webp 150w" sizes="auto, (max-width: 530px) 100vw, 530px"></figure>
<p>From there, you can open the folders and create new files, and you can also see them from your local machine.</p>
<p>At this point, you can mount the Samba share permanently on your Windows system. Click on <strong><mark>This PC->Map Network Drive</mark></strong>. This will open a window for you, provide the <strong>Path details</strong> and click <strong>Finish</strong>.</p>
<figure><img loading="lazy" decoding="async" width="620" height="462" src="https://bluehoster.info/wp-content/uploads/2023/01/samba-3.webp" alt="mount a Samba share permanently on Windows" srcset="https://bluehoster.info/wp-content/uploads/2023/01/samba-3.webp 620w, https://bluehoster.info/wp-content/uploads/2023/01/samba-3-300x224.webp 300w, https://bluehoster.info/wp-content/uploads/2023/01/samba-3-150x112.webp 150w, https://bluehoster.info/wp-content/uploads/2023/01/samba-3-485x360.webp 485w" sizes="auto, (max-width: 620px) 100vw, 620px"></figure>
<p>Then, enter the <strong><em>Samba user credentials</em></strong> and click <strong>ok</strong>. You will have the share available on your This PC.</p>
<h3 id="8-access-samba-shared-folders-from-a-linux-client">8. Access Samba Shared Folders From a Linux Client</h3>
<p>At this point, you can access the share folders from a Linux client. To do this, you need to have Samba packages installed on your server. We assume that you have an Ubuntu client machine.</p>
<pre><code>sudo apt install samba-client cifs-utils -y</code></pre>
<p>Then, navigate to <strong><mark>File Manager ->Other locations</mark></strong> and add your <strong>share</strong> using the syntax below.</p>
<pre><code>smb://server-name/Share_name</code></pre>
<p>Enter the <strong>credentials for the Samba user</strong>. That is it! You have your Samba share on your Linux client machine.</p>
<p>That’s it, you are done with Samba File Sharing Setup on Ubuntu 24.04. Correct configuration is key for a successful **Samba File Sharing Setup on Ubuntu 24.04**.</p>
<h3 id="conclusion">Conclusion</h3>
<p>Samba file sharing on Ubuntu 24.04 provides a powerful and flexible way to share files across different operating systems. With the right configuration, it ensures secure, efficient, and seamless collaboration in any network environment. Setting up **Samba File Sharing Setup on Ubuntu 24.04** correctly is crucial for smooth network operations.</p>
<p>At this point, you have learned to install and configure Samba file share on Ubuntu 24.04, create shared directories, create demo files, and access them from local, Windows, and Linux machines. </p>
<p>Hope you enjoy it. Please subscribe to us on <strong><a href="https://www.facebook.com/orcacorecom" target="_blank" rel="noopener">Facebook</a></strong>, <strong><a href="https://www.youtube.com/@orcacore" target="_blank" rel="noopener">YouTube</a></strong>, and <strong><a href="https://x.com/orcacorecom" target="_blank">X</a></strong>.</p>
<p>Also, you may be interested to read the following articles:</p>
<p><strong><a href="https://bluehoster.info/best-linux-desktop-distro-for-team/">Top Linux Desktop Distros for Teams to Access Remotely</a></strong></p>
<p><strong><a href="https://bluehoster.info/linux-kernel-6-14-features-release-date/">Linux kernel 6.14 Features and Release Date</a></strong></p>
<p><strong><a href="https://bluehoster.info/error-pkgproblemresolver-held-broken-packages/">Resolve Error pkgproblemresolver Held Broken Packages in APT</a></strong></p>
<p><strong><a href="https://bluehoster.info/docker-compose-installation-on-ubuntu-24-04/">Install Docker Compose on Ubuntu 24.04</a></strong></p>
<h3 id="alternative-solutions">Alternative Solutions for File Sharing on Ubuntu 24.04</h3>
<p>While Samba is a robust solution for cross-platform file sharing, other options exist, each with its own strengths and weaknesses. Here are two alternative approaches to consider:</p>
<h4>1. Nextcloud</h4>
<p>Nextcloud is a self-hosted, open-source file sync and share platform. Unlike Samba, which primarily focuses on network shares, Nextcloud provides a complete cloud storage solution, similar to Dropbox or Google Drive, but under your control. It offers features such as file versioning, collaboration tools, calendar and contacts synchronization, and mobile apps.</p>
<p><b>Explanation:</b></p>
<p>Nextcloud operates through a web interface, making it accessible from any device with a web browser. Files are stored on the server and synchronized across connected clients. It supports user authentication, access control, and encryption, providing a secure environment for file sharing.</p>
<p><b>Installation and Basic Setup:</b></p>
<p>While a detailed installation guide is beyond the scope of this article, here are the general steps:</p>
<ol>
<li>Install a web server (e.g., Apache or Nginx), a database (e.g., MySQL/MariaDB or PostgreSQL), and PHP.</li>
<li>Download the Nextcloud server package from the official website.</li>
<li>Extract the package to your web server's document root.</li>
<li>Configure the web server to point to the Nextcloud directory.</li>
<li>Run the Nextcloud installation wizard through your web browser.</li>
</ol>
<p><b>Creating a Shared Folder:</b></p>
<ol>
<li>Log in to the Nextcloud web interface.</li>
<li>Create a new folder.</li>
<li>Share the folder with specific users or groups, granting them read-only or read-write access.</li>
</ol>
<p><b>Advantages of Nextcloud over Samba:</b></p>
<ul>
<li><b>Web-based access:</b> Accessible from any device with a web browser.</li>
<li><b>Mobile apps:</b> Native apps for iOS and Android.</li>
<li><b>Collaboration features:</b> Built-in calendar, contacts, and task management.</li>
<li><b>Version control:</b> Tracks file changes and allows reverting to previous versions.</li>
<li><b>End-to-end encryption:</b> Provides enhanced security for sensitive data.</li>
</ul>
<p><b>Disadvantages of Nextcloud compared to Samba:</b></p>
<ul>
<li><b>More complex setup:</b> Requires installing and configuring a web server, database, and PHP.</li>
<li><b>Resource intensive:</b> Can consume more server resources than Samba, especially with many users.</li>
<li><b>Overhead:</b> Web interface adds overhead compared to direct file system access.</li>
</ul>
<h4>2. SSHFS (SSH File System)</h4>
<p>SSHFS allows you to mount a remote directory over SSH, presenting it as a local file system. This approach is particularly useful for securely accessing files on a remote server without the complexities of setting up Samba. It leverages the existing SSH infrastructure for authentication and encryption.</p>
<p><b>Explanation:</b></p>
<p>SSHFS uses the Secure Shell (SSH) protocol to establish a secure connection between the client and server. Once the connection is established, the remote directory is mounted as a local file system on the client. All file operations are performed over the encrypted SSH tunnel.</p>
<p><b>Installation and Usage:</b></p>
<p>On the client machine (the one accessing the shared files), install SSHFS:</p>
<pre><code>sudo apt install sshfs</code></pre>
<p>Create a local mount point:</p>
<pre><code>mkdir ~/remote_share</code></pre>
<p>Mount the remote directory:</p>
<pre><code>sshfs user@remote_server:/path/to/remote/directory ~/remote_share</code></pre>
<p>Replace `user` with the username on the remote server, `remote_server` with the hostname or IP address of the remote server, and `/path/to/remote/directory` with the actual path to the directory you want to share. You'll be prompted for the user's password on the remote server.</p>
<p>To unmount the directory:</p>
<pre><code>fusermount -u ~/remote_share</code></pre>
<p><b>Advantages of SSHFS over Samba:</b></p>
<ul>
<li><b>Simplicity:</b> Easier to set up and configure than Samba.</li>
<li><b>Security:</b> Leverages the security of SSH, providing encrypted file transfers.</li>
<li><b>No additional ports:</b> Uses the standard SSH port (typically 22), simplifying firewall configuration.</li>
</ul>
<p><b>Disadvantages of SSHFS compared to Samba:</b></p>
<ul>
<li><b>Performance:</b> Can be slower than Samba, especially for large file transfers.</li>
<li><b>User experience:</b> Less seamless than Samba, requiring manual mounting and unmounting.</li>
<li><b>Not suitable for large-scale file sharing:</b> Primarily designed for individual access rather than collaborative environments.</li>
</ul>
<h3 id="faqs">FAQs</h3>
<div id="rank-math-faq">
<div id="faq-question-1740991372853">
<h3>How to start Samba on Ubuntu?</h3>
<p>You can use the command below:<br><code>sudo systemctl start nmbd</code></p>
</div>
<div id="faq-question-1740991491505">
<h3>Why am I getting “Access Denied” when trying to connect to a Samba share from Windows?</h3>
<p>An “Access Denied” error can occur due to incorrect Samba user credentials or insufficient permissions on the shared directory. Ensure that the Samba user exists and has the correct password.</p>
</div>
</div>
</div>