Hey, welcome back to this video.
So in this lesson, we're going to learn how you can configure samba with a specific user.
In the previous lesson, we have learned how you can configure samba for guest user, which basically
means anyone into that network can access your samba share and all your private files.
But now we want to keep access control and we only want to provide access to those users which have
the username and password for our samba server.
So this basically means we are providing authentication and there will be a username and password which
we are going to send.
Which we are going to set for accessing our samba share.
All right.
So for this, we are going to add a username and a password, so let's quickly see that.
So I have already logged in into my pirate OS on which I'm going to configure the samba server.
So first thing first, we are going to add a user which is Shifa.
I have already added a user in my computer.
That is the reason it is saying that user already exists in your computer.
You may not see the error because you do not have this user or in case you have the user and you see
this error, no problem, you can move further.
You can simply set a password for that user as well.
So for simplicity, I'm going to set the password as root for now.
Now I have created a user and I also set a password for that user.
Now I need to add this user to the SMB login list or the SMB user list.
For that, I'm going to use the command, which is SMB pass WD hyphen A.
That means I want to add a user which is shiffer and hit enter and it is going to ask you to create
a password.
So let me again keep the same password as root.
Now I have successfully create now I have successfully created an SMB user as well.
Perfect.
Remember, in case you want to remove a user, you can use hyphen x to remove.
In case you want to add a user, you can use hyphen a perfect.
Let's move again.
Let us modify the configuration file for sampa.
And here once we log in, you can see here I have already written something.
So this is Schieffer's share that I have given the name comment is Samba works I have created a directory
valid users SCHIEFFER and read only know perfect.
So I have specified a user over here which is.
SCHIEFFER You can specify more users if you want by giving just a space over here.
So let's say.
SCHIEFFER, Rohit or X, Y, Z, any user.
Now I'm going to save this configuration file and you need to restart the SMB service in case you make
any changes.
Now, I have successfully restarted it and let me just verify if everything is working fine.
And you can see over here it is active and running, which means it is working perfectly fine.
So it's time to log in and check if the user that we have created is working fine or no.
So let me open up finder and let me open up this connect to server dialog box using the shortcut which
is command k.
Let me connect to the IP address and hit on Connect and let's wait for this.
It should ask us for a prompt and it is asking us for a prompt.
So the name of the user, which is the registered user this time is Shiffer and the password is root
and let's hit on connect.
Let's wait for this to verify.
And you can see she first share.
Let me just hit enter and perfect.
You can see there is a file called A Secret.
Let me open it.
And you can see this is a secret file.
Perfect.
Now, let us verify this.
The same file.
Let's go to the folder, which is Shifa.
And you can see there is a file called a secret text.
Perfect.
Now we are able to complete this practical in which we saw in case there are some confidential or private
files in this computer and we want to share those file on our samba.
So for that, we can also authenticate the user by making a samba user.
So in this case we created a user that was Shifa.
And yes, no guest user can connect to this registered user and cannot access your sensitive files.
So this way you can protect your sensitive content by creating a user and you can configure a password
for that as well.
So I hope you guys understood.
Thank you.