- Samba Linux: The Open Source File and Print Server
- How to install Samba Server on Ubuntu?
- 1. Install Samba
- 2. Configure File Server – Anonymous Share
- 3. Configure File Server – Secured Share
- Conclusion
- Samba Server in Linux
- What is Samba Server in Linux?
- How does Samba Server work in Linux?
- How to Create Samba Users?
- How to access Samba Shared Files?
- Conclusion
- Recommended Articles
Samba Linux: The Open Source File and Print Server
Samba is an open-source software suite that runs on Unix/Linux based platforms but is able to communicate with Windows clients like a native application. So Samba is able to provide this service by using the Common Internet File System (CIFS).
- File & print services
- Authentication and Authorization
- Name resolution
- Service announcement (browsing)
Samba can be run on many different platforms including Linux, Unix, OpenVMS and operating systems other than Windows and allows the user to interact with a Windows client or server. It can basically be described as the Standard Windows interoperability suite of programs for Linux and Unix.
How to install Samba Server on Ubuntu?
Let’s take a look at setting up a Samba Server on Ubuntu to share files with Windows clients. Note that we will create two forms of Samba server. One setup won’t require a password to share files with any client on the network, which is the anonymous share. The other setup will require setting up users and permissions.
1. Install Samba
Binary packages of Samba are included in almost any Linux distribution. There are also some packages available at the Samba homepage. In fact there are now several GUI interfaces to Samba available to help with configuration and management. This article will help you install and set up Samba via the Linux terminal.
We install the samba package from the terminal in Ubuntu with the following code –
sudo apt-get update sudo apt-get install samba
2. Configure File Server – Anonymous Share
a. Create a shared folder called “shared folder”.
sudo mkdir -p /srv/samba/sharedfolder
b. Allow anyone to access and store files in folder.
sudo chown nobody:nogroup /srv/samba/sharedfolder/
c. Edit configuration file to enable sharing.
Make a backup of the configuration file before editing
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.old
Open the conf file and make the following changes –
Add the following at the end of the file to enable sharing – d. Restart smbd service –
sudo systemctl restart smbd.service nmbd.service
3. Configure File Server – Secured Share
a. Create shared folder called “securedfolder”.
sudo mkdir -p /srv/samba/securedfolder
b. Create a new user group named “selected”.
c. Modify permission and ownership for the folder.
sudo chown root:selected /srv/samba/securedfolder/ sudo chmod 770 /srv/samba/securedfolder/
d. Edit configuration file to allow sharing
Make a backup of the configuration file before editing.
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.old
Open the conf file and make the following changes –
Add the following at the end of the file to enable sharing –
[sharedfolder] comment = secured shared folder path = /srv/samba/securedfolder Valid users = @selected guest ok = no writable = yes browsable = yes
sudo systemctl restart smbd.service nmbd.service
f. Once Samba has restarted, use this command to check your smb.conf for any syntax errors. testparm g. Add new users
We are going to create and add a user “Jack” to the user group “selected” with restricted shell access. sudo useradd jack -s /usr/sbin/nologin -G selected To add a password for the user –
h. Add existing user Jane to the group to the group “selected”.
sudo usermod jane -G selected
Conclusion
You should be able to access and browse files from these servers from your Windows client. If you do not see your client automatically, you can try accessing it via its IP address.
You can access the Ubuntu sharing in Windows by entering “\\sharedfolder” or “\\securedfolder” in the windows search field of the menu or use the network browser of the Windows file explorer to connect to the share.
In the case of the secured share, the user will be required to enter the password before being able to access the shared folder. And there it is folks, a short guide to setting up samba server on Ubuntu. You can also check out the official how-to to find out more about installing and setting up Samba.
Samba Server in Linux
In the traditional mode of technology, things were a bit complicated, costly, but still less efficient. The organizations were spending much to manage the hardware and softwares to run their business operations. But in the modern period, technology is making the facilities reasonable for organizations or businesses. For instance, it was the trend of workstations a decade back where organizations preferred to have isolated systems where they could operate their business processes. But in contemporary times, the same organization is preferring to operate their processes in the share platform, and here we are going to get in-depth into one component that made the sharing of resources very easy. Here we will be learning about the Samba server and will be covering its important aspects. In this article, we will discuss Samba Server in Linux.
Web development, programming languages, Software testing & others
What is Samba Server in Linux?
- The Samba server can be defined as one of the most powerful servers in Linux that enables us to connect various resources like printers and files with several operating systems.
- It is the open-source software that is considered as the implementation of the crucial protocol: server message block or common internet file system. It is the system that is based on Linux but makes the communication possible with the Windows operating system.
- The main purpose of this server is to share the files or the printers so that they could be used efficiently. The reason it is considered as a powerful system is due to its capability to perform resource sharing.
- The samba server in Linux may also be considered as the open-source software that facilitates the file and printer like resource sharing very easy and simple. It is ample powerful to establish communication with the window-based systems in order to share the resources.
- It is very important to understand that it leverages the SMB/CIFS protocol in order to work or in order to make the resource sharing possible. It is one of the main tools that Linux holds in order to provide the complete solution to work for making things simpler for the professionals and the organizations. Now we will see how the samba server works.
How does Samba Server work in Linux?
- Samba server in Linux is specially designed in a way to facilitate the communication between the operating systems and several resources. It takes the usage or advantage of the most important protocol called server message block in order to ensure the communication between various systems.
- The working of the samba server is totally dependent on the SMB or CIFS protocol. It works as a central system that has several resources connected to it in order to exchange the data or to access other physical resources like a printer. It makes sure that the sharing mechanism could be implemented using the Linux platform. In the usual case, the process to share files or other documents is pretty complex when it comes to exchanging the data between the different operating system, but the systems that are connected with the samba server can exchange or share the files with ease.
How to Create Samba Users?
In order to work with the samba server in Linux, there must be a user account that will help one to access the shared resources or the files. There is a simple procedure that has to be followed in order to create the samba user. The very first thing is to add a Linux user. The command “adduser username” can be used to add the new user in the Linux or UNIX based operating system; once the user is added, now it turns to add the user to the samba server, which could be achieved using “# smbpasswd -a username” command.
After this command, the user gets added to the samba server. In the last step, you will need to add the user in the samba share so that they can leverage the sharing facilities. The final step will be about adding the user to the samba share, and once it is done, the samba server will be required to be restarted. In order to restart it, you can refer to the command “service smb restart”. After all the steps have been followed, the user will be the legitimate part of the samba server and will be able to access all the facilities that are provided by it.
How to access Samba Shared Files?
Throughout the article, we have been reading that it makes the files and resources like printer sharing possible. Now there must be a question in your mind that how exactly the files can be accessed from the samba server. So let’s go to uncover it. In order to access the files that are shared, one will need to go to the IP address that belongs to the samba server in order to access it. The IP address will be accessible with all of the operating systems that are connected to the samba server and hold ample privilege that is required to access the shared files.
Let us understand this with an example. Suppose 192.168.1.1 is the IP address of the samba server that is having the shared files. If anyone using the Windows operating system wants to access the shared files, they can simply type 192.168.1.1/ in their browser, and they will be able to see all the folders available over there. From there, you can navigate the folder that you want the files from and get access to the files. This is the way how you can access the shared files using the browser available in your system that is connected with the samba server.
Conclusion
The samba server in Linux has been considered as one of the most powerful servers that makes it easy for the other operating systems to access the shared files and useful resources like printers. It is the open-source software which means it will be available to you for free. It works as a centralized system that actually works to connect the various operating system with the available resources that have to be shared. It is a very important server as it helps to make the working easy and cost-effective by make the resources available for sharing.
Recommended Articles
This has been a guide to Samba Server in Linux. Here we discussed the basic concept, how to work, create and access Samba Server in Linux respectively. You can also go through our other suggested articles to learn more –
502+ Hours of HD Videos
54 Courses
4 Mock Tests & Quizzes
Verifiable Certificate of Completion
Lifetime Access
4.5
57+ Hours of HD Videos
15 Courses
9 Mock Tests & Quizzes
Verifiable Certificate of Completion
Lifetime Access
4.5