Contents Of This Tutorial:
What is Samba?
Server Message Block (SMB) is a protocol used between a microsoft cleint and a microsoft server.
When the client requires access to the shared resources of the server it sends out an smb request and server replies with an smb acknowledgement.
Linux operating system does not support smb.
That right there is why Samba was necessary and was developed for sharing resources with Linux.
Windows and Unix/Linux systems have been working together for some time now. Their collaboration is peaceful at it's best.
Samba runs on Unix platform but it communicates with a windows client like a native.
It allows Linux systems to move in to windows network port without causing any issues. Windows users can access files and services without finding out that the services are being offered by a Unix/linux host.
How to configure samba server in linux step by step pdf?
Select the linux system you want to install Samba on and then start executing the commands and following the steps in that section.
Here, with both the tutorials you'll learn how to access linux shared folder from windows.
First we will check out the ubuntu 16.04 samba version tutorial.
How to install samba on Ubuntu 16.04:
Step 1: Start by installing samba package.
sudo apt install samba
It will then ask you whether you want to continue.
Do you want to continue? [Y/n]: Y
Enter Y. You will return to the installation and once that is done execute the following command.
Step 2: If you don't have a file ready to share. Then create one using the following command.
sudo mkdir /media/Storage
A] Next step is to edit the smb.conf file. You can start by opening the file in the vim editor with the following command.
sudo vim /etc/samba/smb.conf
Now find the following in the smb.conf file
WORKGROUP is where you add your workgroup.
Once you find it replace it with your workgroup.
B] Go to the part where you will find code similar what has been shown below and then add the following part right below it.
[Storage] comment = Obsidian storage area path= /media/Storage browseable= yes read only = no guest ok = no create mask = 0755
Now just save the file and exit.
To do that press "ESC" then ":" and "wq".
sudo service smbd restart
Step 4: After that you can create a username and set a password to it.
sudo smbpasswd -a username
New SMB password: Retype new SMB password:
Note: When creating password you have to mention your username. It's how you create a username here.
Replace the word "username" with your user id.
And remember to add or create a user beforehand or you will have to face the following error:
error -> Failed to add entry for user username.
That concludes the ubuntu 16.04 samba installation. You must have noticed that this ubuntu samba install tutorial was quick and short but the important thing to take away here is that it gets the job done.
Next up is "How to install samba on CentOS 7."
How To Install Samba On CentOS 7:
Before we begin let's get this out of the way, the drive that we are going to share is /mnt/XT/Pages.
You will learn samba server configuration in centos 7 step by step.
So, let's begin with this how to install samba centos tutorial.
Step 1: Install the samba package with following command.
You will be shown the download size and the size needed to install the package.
You will be asked
Is this ok [y/N]: .
Enter "Y" and hit enter.
Step 2: This step works on bringing the system online.
systemctl enable smb systemctl enable nmb
Step 3: Rename the file smb.conf as samba.conf.bak
This is the backup file. If something goes wrong during the installation or anytime. You have this backup to rollback on.
mv /etc/samba/smb.conf /etc/samba/samba.conf.bak
Step 4: Let's create another configuration file using the following command.
Step 5: Once you have created the file, we need to edit it.
After you open the file add the following content to it.
[global] workgroup = WORKGROUP server string = Samba Server Version %v security = user passdb backend = tdbsam [Pages] path = /mnt/XT/Pages valid users = priya guest ok = no writable = yes browsable = yes
After you make the above changes, save the file and exit.
we are setting passdb backend to tdbsam as a direct response to the user requests. The ones that allows simple site
operation barring the overhead of the complexities of running OpenLDAP.
It's for the sites that have less than 250 users.If your site has more traffic that you should use OpenLDAP or active directory integration.
Priya is a valid user here.
Step 6: Restart smb.
systemctl restart smb
Step 7: When you try to access your share drive. It will ask you for credentials i.e. username and password.
We have mentioned the user "priya" in the configuration file.
So, now we will create a smbuser priya and assign a password to the user.
smbpasswd -a priya
New SMB password: Retype new SMB password:
Step 8: Now go back and try to access your share drive. You can fill the username and password field to access the drive.It should all go well.
Note: If you still can't access it, you should check out the permissions with the following command.
Check the entry of the file you are sharing. The issue you are facing is because of nfsnobody.
To resolve that issue you will have to change the owner and then permissions.
chown -R root:root /mnt/XT/Pages
We are now going to set the permissions read, write, and execute for the user Priya.
setfacl -Rm priya:rwx /mnt/XT/Pages
Using getfacl you can find out the users that can access the files.
getfacl /mnt/XT/Pages systemctl restart smb
If that doesn't work then execute the commands below.
getenforce chcon -t samba_share_t /mnt/XT/Pages systemctl restart smb
Step 9. That's it. You could access other files or directories by editing the smb configuration file.
When the file open you can make the following changes.
[global] workgroup = WORKGROUP_NAME server string = Samba Server Version %v security = user passdb backend = tdbsam [Pages] path = /mnt/XT/Pages valid users = priya, tom guest ok = no writable = yes browsable = yes
As you can see we can add more users. Just separate the previous user by a command leave a space and then type the name of the user.
To know about samba you can refer ubuntu samba gui.
It is the official document that belongs to samba.org.
Refer How To Install Vsftpd On Ubuntu Server 16.04 (For A User Directory) to learn more about file tranfer.
Be it Vsftpd for file transfer or Samba for sharing drive the end goal of both is get you maximum security while these transmissions take place.
Learn how to Harden Ubuntu security for 16.04 server with this Complete Guide.