Samba File Sharing from Mint 19 to Windows 10

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
you okay this video is for my students and what we're gonna do in this video is I'm gonna share a folder from my Linux Mint virtual machine here to my Windows laptop were over the network to any Windows computer or Apple computer using Samba so that's what we're gonna do we're gonna make this work file-sharing Samba file-sharing from Linux to Windows so first of all let me make sure I'm on the network here I'm going to click on my wired connection make sure I have in my Windows computer I'm on the wireless network that I want to be on they should get put on the network here in a second and what I want to do is make sure I can let ping a website which I can do here great control see to quick that quit that although tan if config and see what my IP address is looks like I'm 192 168 3.93 now I'll need this IP address I'll need to remember it so 3.93 okay excellent the next thing that I'm going to want to do is take a look at my firewall so so right here in mint I am going to well I'll just launch it here from the command prompt so su new GU at the W but in my password and there's my firewall let's take a look at the rules you can see I have some rules from a previous lesson now what I want to do is I want to add rules for samba so I'll click Add and I'm going to use pre-configured Samba rules so let's see here allow I'll just click on application here and then use the arrows on the keyboard to quickly go down to the esses which takes a second here all right and there is Samba and I'll click Add you can see here it's add added port 137 138 UDP allow in anywhere and it's also allowed 139 and 445 TCP allow in anywhere so close and the name is Samba so I've got that these two rules were just added for Samba for ipv4 and Samba for ipv6 so I can leave my firewall on because I've added those rules otherwise if not if you're not going to add those rules you may have your your firewall your uncomplicated firewall running in that case you may want to do a sudo service stop ufw to stop it or I'm sorry sudo service ufw stop there we go so if you're not gonna open up those rules on your firewall you may want to stop the firewall okay but I I added those rules so we'll see if that works it should work fine all right clear then before I get started to what I'm going to do is is I'm going to go to my control panel here's my control panel then I'm going to go to network and sharing center and I'm going to see here that my under change advanced sharing settings changed advanced sharing settings my current profile is private network I want to make sure I have turn on network discovery check marked and turn on file and printer sharing on whatever my current profile is whether it's private public or all networks anyway I need to have file and printer sharing activated internal network discovery I do so that's good ok I'll go back to the control panel and I'm also going to go to programs and features and this is an important one programs and features and over here on the Left there's turn Windows Features on or off so I'm going to go in here it opens up a pop-up window and then I can scroll down to Samba you can see here it's SMB 1.0 CIFS file-sharing support this is the SMB protocol I can expand this and what I want to do is I'm going to turn on the SMB 1.0 CIFS server I'm going to check mark that by a default mine was off so I I added it so as you can see i have SMB one point i have both of these check marked and SMB direct i have that check marked so for this lab i have all 4 check mark and for me to get it to work I had to make sure I had the server activated here it says here that the server file server for sharing data with legacy clients and browsing the network neighborhood so I'm just going to have it activated maybe we don't need the server you would think you wouldn't you would just need the client but in my case I activated the server and I was able to get it to work all right so do that click OK and make sure that it's activated all right so I have both of those things also for the testing purposes in the lab you may also want to go to and check your firewall settings in Windows 2 so let's see your start firewall Windows Defender firewall let's check my settings right here right now I have the Windows Firewall off on both so I just have those off you know that's another thing that could complicate things it shouldn't but it shouldn't you know you should be allowed to connect out over the firewall but just in case I have it off so it doesn't cause any problems all right now it's time to set up Samba now we can go through and start setting up someone so the first thing I'm going to do is I'm gonna run a studio app - get update and I'm running mint 19 here so it's important to know which version of mint because from one version to the next sometimes services like this and things can change and all of a sudden that lab that worked no longer works okay so I've updated my my repository of software packages that I can download and install so let's install it so sudo apt install and I'm gonna install Samba and Samba - common - bin so two programs I'm installing with a sudo apt install Samba and Samba - common - Jen and I'll hit enter for yes you you you okay so now that I have it installed I can take a look at it let's take a look sudo service smbd status and you can see if I do a sudo service SMB status that it's active and running great now for sama the Samba server to allow users to connect to its service and to file shares you need to add users to the Samba service I so I'm going to do next and for that command what I'm going to put in here is su do SMB passwd all one word sudo SMB passwd - a and I'm going to add a user named Dan now notice my my computer's name Dan as well here so I'm going to add that user damn and I'll be prompted to put in a password I'll put it in notice it won't give you any hint that you're putting in your password you just have to trust that the characters are going in I won't show you the password even show your asterisk indicating each character in the password it just puts in the tennis we're doing twice okay great so I've got that so now in a previous exercise I told you that the root folder inside the root folder is the etc' folder and that's for configuration files so let's go check that out so I'll say LS show us what's in root et Cie and if I scroll up you'll see there's now a folder called Samba in root et Cie alright so let's say all right a barrel LS so most what's in rude et Cie sama and inside there you'll see there is a file called SMB calm that's your Samba configuration file that you're going to use to configure samba basically all your configurations are going to go right in this text Wow so let's back it up to start with so studio copy route BTC Samba yes so I want to copy bring etc' saw that okay that backs up my file in case I just I can always revert to the backup file alright now we're going to add some configurations into the SMB configuration file to set up our file share so for that I'll say sudo and instead of using the copy command I'm going to use a banana command line text editor I'll just use nano sudo nano root et Cie samba SMB cough let's open it up and edit it so here it is this is the configuration file this is where you could set up for your file shares your your print sharing you can set up domain authentication you can set up a domain controller through samba all kinds of stuff you can do here well we're going to do is I'm just going to scroll all the way to the bottom and that's where I'm gonna add my file share so down here I'm going to add a file share now the first one I'm going to add is in between brackets here I'll call it share there you go there's an original name share I'll say comment and polls comment equals my share and then path equals we're gonna have the share located in root SRV samba forward slash share so that's where our share will be located in root SRV Samba share now right now we have root SRV but there's no directory sum and there's no directory share we'll have to create one in a minute we can do this now and do that afterwards so browsable equals let's see your browsable equals yes guest ok equals yes we'll guess to access this this folder ok is it going to be read-only no people be able to write to it and then create mask if they create a folder in there it'll have 0 7 5 5 permissions and then I'm going to put a comment and force user equal to Dan so if we want to force one user only to authenticate we can uncomment this and say force user Dan and then get rid of or comment out the guests ok equals yes so in other words if I want to get rid of guest access and force user authentication force user dad I can do that but for right now we'll try to do this without without a password so without authentication then we can also do a second shared folder let's do a second shared folder right now so we'll call this share two and for this one we're gonna put this one in a different location I'll say the path for this word is enroute home your user account whatever your user account is on your system for me I'm Dan in some way home in my home folder there's a folder named Dan for my user account I'm gonna make a folder named Samba in there that's the path and this has slightly different settings available equals yes and these I got these settings just by looking online there's different kind of settings so available yes valid users equals there's so many different settings read-only browsable public yes these settings by just doing some research online on different tags notice this one says writable yes but on the previous one I didn't use that I just said you know read-only No so anyway different settings here for the between the two let's let me kind of stretch this out so you can see so there are my two shares that I'm going to be setting up okay so there's the two shares great to quit out control X Y to accept the changes and then enter to accept the file name so that's control X Y and enter to save and close the file alright and now we're going to go in and we're going to make those directories that we need for this to work - P in root sr v ford slash sama ford slash shear so this will recursively make both the Samba folder and the share folder in root SRV see right now I don't have those folders in there but now I do so just to check now LS show me what's a root that's I mean you can see there Samba and then LS show me what's in this RV Samba and there's granny now I'm going to change the ownership of this share folder right now if I do an LS dash L on root SRV song you can see it this share folder is owned by root and the root Greek so let's change that so soon shown changeover to nobody : number and they change route sure okay that looks good so nobody no group if that looks good all right so now I've changed that ownership let's double check that now you can see that share the owner is nobody and the group is no group all right super next what I want to do is create a text file in that shared folder so what I'll do is up arrow in that shared folder let's see here I'll use a touch command to create the file and root servers on the share then I'll call it hello txt so I just made the file in there and then I will echo text and redirect into permission denied okay oh all right fine let's see here so let's take a look permission denied let's check at the permissions on that file all right if I do an LS less long root server Samba share hello dot txt is owned by a root okay so I'm you would think with a su do I could add some text to that file but before I do that anyway I wanted to change the ownership of this file I wanted to change the ownership of this file anyway to user Dan because that's who's going to be basically using the file sharing to access the folder and change the file anyway so let's change the ownership of this file so what I'll do is I'll go back here to my shown sudo shown we're going to change this from nobody no groovy all right I just change the owner of this file to Dan and now let's see if we can echo that text in there good all right no problem so anyway I needed that to be owned I wanted this file to be owned by user Dan my owner Dan and group dead so anyway that's good so now I'm set with that now let's make our other folder that we wanted to make right now in my home directory I've got these folders so what I'm going to do is I'm going to make a folder named Samba my home directory this is for our second share so I'll do an MK dir since it's my directory I don't need to use a suit and I'll just say in my home directory make a folder named sama all right then I'm going to is a touch command and my home folder touch Samba in the Samba directory make a file made text dot txt great and then let's echo some stuff into this so we'll say hello redirect it into that file great alright now I've made my two shares if I want to browse this share I go to my home directory and let's see here there's Samba inside Samba there's text txt and you can see it's a text file it says hello right if I want to take a look at the other file I could cap what is in SRV so I could cut out that file and says this is some text if I wanted to change that file I'll need a sudo command well actually it's owned by Dan so I don't know if I'll need a suited command but anyway it's in there and and there we go so I've got two shared folders one that I'm going to share from root file root folder root directory SRV Samba share in the files hello dot txt M this is my share of the share folder and then the other one which is in my home folder and is in a folder named Samba and I have another nest my other share ok great so no clear and then now to restart let's see service it'll also restart NBD for good measure so I restart that service so I've restarted both services if I want to check the service status you can see it's active it's running the Samba SMB daemon super now I can go to windows move this out of the way and open up a directory in windows so here's my PC folder here and you can see I can go to the network here and there's a bunch of computers on this network there is my damn - VirtualBox which is if you look here it's dan that's the host name of this virtual computer this mint computer is Dan - VirtualBox there it is I could just double click on it to go inside of it or I can go up here and put backslash backslash and type in the IP address I forget what the IP address was that's just doing if config just to verify it's 192 168 3.93 so back here backslash backslash 192.168 3.93 you can see it asks for my network credentials so I'll put in Dan and my password and you can see I have two shares here there's the first share and the second share in the first year there's hello detects this is some text cool file save boom I was able to say that all right and then in the other share open this one up hello there file save and I was able to save that too so I can alter these shares and with some change to my settings in my Samba configuration file my SMB comp file in it meant I could change those settings so that maybe these shares are not writable you know I don't I won't have access to change the files in here but right now they are writable and let's see here if I can maybe I can make a folder in here to new folder see it says oh you don't have permission in here to make that folder okay what about here new folder dance I was able to make a folder and share - but not in share one so I could change some permissions for that anyway that's interesting now you I think I had to authenticate basically because of the second fair share to like I didn't have share to I don't think I would have even needed to authenticate we could always test that out would you like to test that out let's try it out here so what I could do is is I could say all right let me go back in and edit that file there's the file I want to edit sudo nano brute et Cie salamis all comp no let's go all the way down to the bottom and I am going to get rid of here to here so I'll say calling by commenting it out a hash in front of each line now all I'm left with is the share the regular share which should be browsable the guest should be okay and it should be full access so control X control X Y and enter to save and close then restart smbd with a sudo service SMB not status wait a minute cute to get out of there now I want to restart restart there we go new service smbd restart so there's my restart now if I go back to network this time instead of putting the IP address I can just double click on Dan - VirtualBox here you can see I only have one share and I'm in and as you can see I didn't have to authenticate either it didn't seem like I had to authenticate at all and you can see and there's the file now cool file file save now you can see that I was able to say change this file but not able to create a folder or create a file new let's say text document nope so let's go back into our configuration here and see what we can do to possibly add that piece I'll go into my configuration file here and let's take a look here at the bottom and let's see here now what did I need here read-only well how about writable equals yes let's try that yes until X Y and enter restart the service back here to the Cher right click new text document No I still don't have access I may need to authenticate to be able to write here let's try that so what I'll do is I'll go back here and at that file one more time or I'm not sure what I'm missing but let's change it slightly let's say okay horse user Dan guests okay comment that out so no longer is guest okay alright you that looks good so now we're using force user dan I got rid of the guest okay control X Y and enter restart the service go back over here back in maybe I'm not being asked to authenticate because I had authenticated previously so share and new text document I still don't have permission hmm bummer maybe I don't have permission because this folder this directory is in under route route you know the directory is part of route SRV samba right and let's see here LS let me do that again so maybe I need to I would need to change some permissions in other words nobody no group is who has permissions to the share and maybe I can't write to it because the folder itself is not owned by user Dan and group Dan right now it's owned by nobody no group because you're in it's interesting because what we could change was inside the share I could change the file hello.txt which was owned by Dan and group so so anyway that's interesting regardless you were able to set up two shares with permissions in in one share which is to your home folder where you could change the file and create new files and then this other one that's in the root under root under SRV in a non home user directory that has less permissions but still allows you to share documents and you can play with your Samba settings to fine tune it to just what you know to microcontroller or have more refined control over what what is happening so in the end here I'll go back down and I'll see ya that I like what's happening here but I'm gonna bring back my other share and then restart the service and then I have access so now I'm sharing directories and files from Linux across the network to Windows computers Apple computers you name it anyway thanks a lot
Info
Channel: danscourses
Views: 56,755
Rating: undefined out of 5
Keywords: Mint 19, Samba, SMB, Windows 10, VirtualBox, danscourses, Linux, file sharing, server
Id: dxUWco22_uk
Channel Id: undefined
Length: 34min 18sec (2058 seconds)
Published: Sat Apr 27 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.