Samba is a widely used open-source software suite that allows interoperability between Linux and Windows systems, enabling file and print sharing across networks. AlmaLinux 8 is a popular Linux distribution that is a drop-in alternative to CentOS 8. This guide will teach you about install and uninstall Samba on AlmaLinux 8, ensuring seamless integration between your AlmaLinux system and Windows-based networks.
To install Samba on AlmaLinux 8, you need to meet the following requirements:
– Access to an AlmaLinux 8 machine with root privileges.
– Internet connectivity to download the necessary packages.
– RAM: It is recommended to have at least 2 GB or more.
If you need to buy a Linux VPS server to run Samba, we suggest you to use the various, high-quality and location-variety plans offered on our website.
In the first step, you should install Samba on AlmaLinux 8 by executing the following command:
sudo dnf install samba samba-client
SMB is a daemon that handles the actual transfer and sharing operations and nmb performs the NetBIOS name resolutions and allows resources to appear in Windows while browsing the network.
After installing the packages, you need to start and enable the SMB and the NMB daemons at the boot:
sudo systemctl enable --now {smb,nmb}
AlmaLinux has a firewalld that is enabled by default. The firewall blocks other connections of computers trying to access the Samba service. In this step, you need to allow the proper ports through the firewalld with the help of the following command:
sudo firewall-cmd --permanent --add-service=samba sudo firewall-cmd --reload
You can add the –zone option to the above command if configuration is needed.
You can setup a Samba Share without the need for an account, But it’s better for people who connect to Samba Share to create user accounts. Each Samba user needs a normal user account on the AlmaLinux account.
You can create a new Samba account by running the following command:
sudo adduser -M sambauser -s /sbin/nologin
The -M option is the short form for –no-create-home, and the -s option allows you to specify a shell: /sbin/nologin. There is no need to set a password for a user account, just a password for the Samba service.
You can create a Samba password for the newly created user by entering the following command:
sudo smbpasswd -a sambauser
Now it’s time to configure the directory you want to share via Samba:
In this tutorial, a shared directory is made at /mnt/shared:
sudo mkdir -p /mnt/shared sudo chmod 777 /mnt/shared
Then you need to open your configuration file with your favorite text editor to edit it:
sudo nano /etc/samba/smb.conf
Next, you should go all the way to the bottom of the file and paste the following lines:
[neuronvm] path = /mnt/shared guest ok = no read only = no
Save the changes to the file and exit it. You should restart the Samba service by entering the following command for the changes to take effect:
sudo systemctl restart {smb,nmb}
Now it’s time to allow Samba through SELinux. SELinux is also enabled by default in AlmaLinux. You should assign the appropriate context to your shared directory and files. This allows Samba to function while keeping SELinux in the recommended enforcing mode:
sudo chcon -R -t samba_share_t /mnt/shared
Other systems should be able to connect to this directory to upload or download files from the Samba server.
First, you need to create an empty directory by entering the following command to use it as a mount point for the remote Samba share:
sudo mkdir -p /mnt/fileserver
In this step, you need to install the remote Samba share to the folder you just created by executing the following command:
sudo mount -t cifs -o username-sambauser //192.168.1.10/neuronvm/mnt/fileserver
Enter the password to mount Samba Share.
Now you should access your Samba share from Gnome’s file manager:
smb://127.0.0.1/neuronvm/
Remember to replace the IP address.
The Samba share will be installed on the left side of the Gnome file manager.
You can remove Samba from your AlmaLinux server by executing the following command:
sudo apt-get remove --purge samba
If you have client problems, enter the following command to remove the SMB client:
sudo apt-get remove --purge smbclient libsmbclient
Install and uninstall Samba on AlmaLinux 8 is a straightforward process that allows you to enhance cross-platform compatibility between Linux and Windows systems. By following the steps outlined in this comprehensive guide, you can easily set up Samba to share files and printers, and later remove it if desired. Enjoy seamless integration and efficient network collaboration between your AlmaLinux system and Windows-based networks.
You can find the samba configuration file at /etc/samba/smb. conf.
If we compare these two, FTP is much faster and more efficient than samba. file transferring protocol in FTP is better.
How useful was this post?
Click on a star to rate it!
Average rating 5 / 5. Vote count: 1
No votes so far! Be the first to rate this post.
HAProxy is a free, open-source software that provides high availability, load balancing, and proxyin...
MariaDB is an open-source, popular, and free database management system and is a compatible drop-in ...
What is your opinion about this Blog?