Categories: Ubuntu

How to Remove and Uninstall Samba from Ubuntu

Samba is a powerful file-sharing tool that allows you to share files across multiple systems running different OSs and all connected through the same network. Samba is an ideal file and print sharing solution for even a scenario with thousands of users. Also, it allows connecting a Linux system to a Windows domain.

There can be number of reasons why someone would want to uninstall Samba from its Linux machine. One of the reasons can be to remove and reinstall Samba because a fresh installation sometimes solves certain issues. Another reason is if you no longer want to use it for file sharing. Whatever the reason may be, you can completely uninstall Samba from your Linux machine.

Sponsored

In this post, we will cover the process on how to remove and uninstall Samba from Ubuntu OS. Let’s get started.

First, run this command to see if Samba is installed on your machine:

$ samba –version

The version number in the output confirms that you have Samba installed in your system.

Uninstalling Samba from Ubuntu

Follow the method mentioned below to uninstall or remove Samba from your Ubuntu machine.

  1. First you will need to launch Terminal. To do so, click the Activities in the upper-left corner of your screen. This will open a search bar for you to look for and launch any application. Then type terminal in the search bar. Once you have found the Terminal application in the search results, launch it by clicking the icon.
  2. Then enter the command below to uninstall Samba:
$ sudo apt remove samba

You may be asked to enter the pseudo password. Type the password and hit Enter. Then it might ask if you want to continue the operation. Type y and hit Enter to continue.

This should remove Samba from your Ubuntu machine.

There are two other Samba packages Samba-common and Samba-common-bin that are also installed along with Samba. You can also remove those packages through the command below:

$ sudo apt remove samba-common samba-common-bin

It might ask if you want to continue the operation. Type y and hit Enter to continue.

Sponsored

This should remove Samba-common and Samba-common-bin packages from your Ubuntu machine.

To remove the dependencies that were automatically installed along with Samba installation, run the command below:

$ sudo apt autoremove

When prompted for confirmation, type y and hit Enter.

Purging Samba

If you want to remove Samba along with the configuration files, you will have to use the purge command. Run the command below to purge Samba:

$ sudo apt purge samba

It might ask if you want to continue the operation. Type y and hit Enter to continue.

Sometimes, the purge command does not delete some Samba directories because they are not empty. To delete those directories too, run the command below:

$ sudo rm -r /var/lib/samba/printers/x64
$ sudo rm -r /var/lib/samba/printers/W32X86

This post covered how to remove and uninstall Samba from Ubuntu. It also covered how to purge Samba if you want to delete the configuration files of Samba as well.

Ubuntu Server Admin

Recent Posts

Canonical Releases Ubuntu 25.04 Plucky Puffin

The latest interim release of Ubuntu introduces “devpacks” for popular frameworks like Spring, along with…

2 days ago

Ubuntu 25.04 (Plucky Puffin) Released

Ubuntu 25.04, codenamed “Plucky Puffin”, is here. This release continues Ubuntu’s proud tradition of integrating…

3 days ago

Extended Security Maintenance for Ubuntu 20.04 (Focal Fossa) begins May 29, 2025

Ubuntu released its 20.04 (Focal Fossa) release 5 years ago, on March 23, 2020. As…

3 days ago

Ubuntu 20.04 LTS End Of Life – activate ESM to keep your fleet of devices secure and operational

Focal Fossa will reach the End of Standard Support in May 2025, also known as…

4 days ago

Ubuntu MATE 25.04 Release Notes

Ubuntu MATE 25.04 is ready to soar! 🪽 Celebrating our 10th anniversary as an official…

4 days ago

Ubuntu Weekly Newsletter Issue 887

Welcome to the Ubuntu Weekly Newsletter, Issue 887 for the week of April 6 –…

6 days ago