Samba is a networking tool that is used to connect Windows and UNIX, with the help of this connection we can share files between UNIX and Windows. It can also share the printers installed on the server of the windows client.
This guide helps us to understand the installation of Samba as well as to set up its configuration settings.
How to install and configure Samba on Debian
Before the installation, we will update the packages list.
Now we will install the Samba on Debian:
Samba configuration can be found in /etc/samba/smb.conf. It contains all the configuration settings for itself and for the files which have been shared so is known as Global Settings. Open the path by using the nano command.
The output should look like this.
Some settings are in the configuration file that should be discussed before making any modifications. The first setting you will see is the workgroup which tells you to which operating system you are connected. By default it is WORKGROUP but if you want to connect with some specific group then you can change it. The next one is an interface, it will tell you which IPs are allowed by you to connect with the samba network, so by this setting, you can make your samba secure that all the devices cannot connect to it only a few ones can connect to them which are allowed by you.
Next is share definitions, here by default some user directories are present like the home directory and the printer directory, with which the files can be shared using the Samba.
Now we will try to create our own user, for this enter the user name; in our case, we choose [New_share] as the new user:
In the next line after the four spaces describe the new user as:
Set the path to be shared for example:
Now tell it whether you will browse it to the share or will mount it manually:
Now set the settings either it will be readable only or can be edited by other people:
You can set the password so the anonymous user, the user outside the network server, cannot access it and you can also not set the password so they can use it:
If anonymous people cannot access it, then allow the user who can access it.
Now press CTRL + X then type “y” and press ENTER key to save and exit the editor. After all, this restarts the Samba.
Go to the root user mode by:
And set the password for the Samba. You can replace the maadi with your username, type a password then confirm it by retyping, and when the user is added so type exit so that the root user mode terminates. In the command flag “-a ” is used to add the user.
There are some packages that are to be installed so that we can connect to the newly created user.
Open the files of Debian, go to the network, and choose Debian.
The share, New_share is visible which we have created.
Now we can share files from any Linux machine to the new user if the user is a member of the same LAN.
Conclusion
We can add the single printer to the LAN so anyone (who is allowed) can print the documents from his/her own computer. In a company, the staff communicate with each other through the local area network, by adding the users so they can access the folders of any other computer and copy files from there without physical movement, this type of assistance can be done by using different software in Linux and Windows; one of the renowned utility for this purpose is Samba. In this writeup, we have discussed how to install samba in Debian and also configured it by making a share file using it.