Here, Today! let’s discuss samba file share service with Ubuntu 20.04 LTS. If you need to share files between Linux and MS Windows Systems, CIFS or SMB is the way to go. The CIFS protocol is a server-client model. The system that host file to share, need to run Samba server as well.CIFS is an extension of SMB or server message block, a protocol developed by Microsoft. In Linux, we can use Samba software to connect CIFS-SMB shares. Also, in a basic set of default samba configurations, there is a list of shares or locations. By default, these locations with few restrictions are available too for the remote client to access.
Samba services how work with Ubuntu 20.04 LTS, this is what we will learn today. Let’s begin.
What you will learn:
- Installing the package, with examples.
- How to configure services.
- Finally, how to mount and use samba shares.
- An Ubuntu 20.04 LTS Machine.
- Also, MS Windows Desktop.
- Samba packages, of course for Ubuntu.
- Good internet connectivity.
Get Samba File share services ready:
Let’s get the Server ready first. Go and download Ubuntu OS. Second, install all required software as well.
Make required file changes
Install samba packages
#apt install samba
Let’s have a look is samba services are running proper or not?
# systemctl status smbd
Let’s see which files are visible in Samba default directory, will look something like below:
Edit smb.conf file, it is recommended to take a backup of original file first.
Create a shred directory which you would be using to get accessed from MS Windows client, in our example we created folder named as “sambashare”.
# mkdir /home/ubnt/sambashare
Let’s edit /etc/samba/smb.conf file, Make required changed as per below, add changes at bottom of the .conf file:
# nano /etc/samba/smb.conf [Samba-Windows-Share] comment = for windows share path = /home/ubnt/sambashare read only = no browsable = yes
Press ctrl+o followed by ctrl+x to save and exit from file.
Allow samba on firewall and start service.
#ufw allow samba Rules updated Rules updated (v6) #service smbd restart
Setup Samba password and access shared folder
As, samba do not use default user’s password. Let’s defile samba password for existing user, in our case user is ubnt.
# sudo smbpasswd -a ubnt
Change file permissions for shared folder, so that end user can add or remove files, defile permissions as per your need.
# chmod 777 /home/ubnt/sambashare/
Now, Samba server is ready, lets switch to MS Windows and see. Open Run and provide Samba server IP Address. In our scenario that IP address was 192.168.1.239.
press enter, shared folder creds which we have created in previous step is visible:
Give user id and password created recently with smbpasswd command, in my scenario first attempt login didn’t work, but don’t worry, give another try. it will work.
Lets try to create folder or file and see, whether that file is visible in Linux Machine or not. I have created Test_Folder and Test_File.
Lets have a look in Ubuntu Samba server, if these files are visible or not.
Bingo! we have created and tested samba server successfully. Give a try!!