How to setup Samba for File Sharing in Linux

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video I go over to quick and easy ways to set up Samba shares in Linux so let's start this out if you're running Ubuntu or the Nautilus file manager it is the easy way to actually share something so let's say I want to share locally my Dropbox folder I can right click go down to local network share and then you'll see the folder sharing we want to share it and I'll say service is not installed we want to install that service and install so this installs the Samba package and then also any sharing service that needs to be done okay with that complete we can go and say hey how do we want to rip limit this share I want to do guest access so anybody on that my network should be able to access this share quick and easy and if you want others to create or delete files in the folder giving them write privileges click this and it will allow them to add and subtract files so we'll go ahead and hit create share and add permissions automatically would add these one second I don't want to do this quite to my Dropbox folder so I'm gonna hit cancel okay let's say I wanted to share this AMD GPU probe folder all right click and hit local network share share this folder allow this gives write access to anybody with this and guest access as well so it's saying share name is too long any warnings appear right here so let's go ahead and change that share name to something a little shorter with that we can hit create share and it will go ahead and add permissions automatically so guests could actually write to this so hit add and now you'll see that icon changed to this little sharing now a lot of people think that this actually is a separate sharing service other than inaudible but this actually installs samba and automatically configures it without having to go into terminal which is really great because a lot of people mess up or just paste a ton of stuff into terminal now when doing this so let's go over samba sharing in terminal I'm gonna walk you guys through as I do each line I'm gonna explain what I'm doing in the SMB dot comp file which controls Samba and that way you know what you're doing and I'm also gonna do stuff incorrectly there's gonna be two things I do incorrectly in this video which I'm gonna kind of backtrack on so when I'm doing this I'm gonna type in something wrong there's going to be some kind of miss configuration in the comp file I want you to see what it looks like when you actually do something wrong on it and how to fix it or just take it out and then also the share name and the actual path are different so you can create a folder name it test two and then you can create a share and name it test one and map it to the folder test two so you pull it up on the windows machine it shows the share is test one you click into it but you're really in the test two folder because that was in the path line I wanted to explain those two things before I jump right into the terminal and show you guys what's going on and make it a lot easier so more Linux users understand and kind of demystify the SMB dot comp file so that's what I'm gonna do right now okay let's start out by creating a terminal session here and we're gonna go ahead and create a new folder to share it doesn't matter we could share an existing one but for this instance we're gonna create a new one we're gonna call it make directory test share and if we look their test share popped in so with that done we need to edit or create our SMB comp file so if we go to CD etc' Samba let's do a long listing I see our existing SMB file I highly recommend just going move SMB comp to s b.com old I'm gonna just go ahead oh and help if I did sudo alright so what that did is it completely cleared out my config we're gonna start with a blank slate and I'm gonna go sudo gieta SMB kampf so we're gonna start out with this brand new file here completely from scratch so what I don't like is many other tutorials out there just do a copy-paste of a whole bunch of junk and many home users are just trying to create shares and it just drives me crazy so I'm gonna try and make this as simple as possible I know I'm gonna get ridiculed by some system admins for this but for simplicity sake for the home user that's what the who this is for it's targeted for those new Linux users that are just trying to set up shares so global is the first tab we need so global make sure you spell it right and then we need to define the role so server role equals standalone server and then next we need to map our guests so map to guest equals bad user basically this says hey if someone does an anonymous login or fails to log in correctly what do we do with this user do we put them as a guest if they're a bad user in this instance it would now if you wanted it to be to where it never let anybody in on a failed login or an anonymous user you'd put never here however we're gonna make this simple so bad user and then we need to allow guests also by doing user share allow yes equals yes and that will allow guests from here I like to add a little bit of security not much honestly I could go on to the next one just leave these three lines but I always recommend at least a some way of limiting down a completely wide open chair like this so let's go ahead and do that we're gonna go host allow 192 168 0 dot 0 16 anything this one starts with 192.168 will be allowed so that's any private address from pretty much any residential home will fall into this address range that's 192 168 1.1 that's 1 9 2 1 6 8 255 dot 255 all these work just fine and then host deny equals 0 dot 0 dot 0 board slash 0 and this just denies anything that's not in that range so let's say a hacker gets in from an external address and tries to do it he'd be denied just a general good best practice I like adding those lines you don't have to if you run into problems you can remove them it's not an issue so let's start with our first linux share so to do this we're gonna just call this test share boom and then we create a comment for this share this is just a test share we create a path I'm gonna use my home directory so fort slash home Titus four slash test share we could also call this just test folder and we need to create read only equals no this makes this writable and then guest ok equals yes so anybody that accesses a guest now normally people would stop here but I'd like to take it one step forward because if you create stuff in this folder it would basically stick out as owned and operated by nobody that was who'd be assigned by it which means as me being user Titus I wouldn't be able to write or change the file which is kind of a bummer so I don't like doing that so I like to go a little bit further and force create mode equals zero seven five five what this command does is it makes it to where it will make it writable and executable by anybody that creates it and read an executable by pretty much everybody else and then force anything that is created to be associated with my user Titus and force group equals Titus so with that we're pretty much done those force users and groups basically makes it to my local user which is named Titus it makes it so I can easily do this and anybody that creates anything in this folder will basically be assigned to my user to where I could edit do anything I want with those files so let's go ahead and save that and exit it because we're done with the config file from here we test parm this test parameters of our Saba and if we look here let's look for any warnings force create mod it shows that's an unknown parameter so let's go ahead and take that out I might be incorrect in what I put there so let's go ahead I don't want to leave that force create mod we're just going to remove that we'll see what it actually creates the files as I honestly think it'll be the same so probably didn't even need that in there with this we'll do a test parm again and now it shows no warnings everything looks good and we can go ahead and dump our definitions and take another quick gander at our file again I'm pretty satisfied with everything showing up here from here we can reboot the servers so sudo service smbd restart if you're using Fedora CentOS or Red Hat please note that's SMB not smbd everyone else is pretty much smbd sudo restart a service smbd restart helps if you spell alright from here we are pretty much good except we need to check our home folder CD home because we created a file tests share and I want to just double check to make sure that is right test folder so our folders actually I'm gonna go ahead and change that test share to test folder so move test share to test or redo that okay just to make sure that it maps it to the right one so that path file is test folder it's gonna be called test share but it's actually mapped to the path which is test folder so we'll go ahead and exit here so before I actually pull up the windows box I want to go ahead and launch into a version of Windows here that basically will show you how to enable Samba base sharing in Windows it's very important you understand a lot of Windows by default do not allow samba or SMB shares so it's it's really important that you pay attention to this and make sure this is enabled because you're gonna have a lot of heartache in Windows machines connecting to samba if you don't have this feature so this is done through Admiral programs in your thing a shortcut to get to add and remove programs as app whiz Cpl right here and this pulls up this programs and features screen another way of doing it is also going just programs and features into your search it would actually pull up or you can just pull up control panel and do it through here as well so very familiar for you guys but over here on the left side look on here and you'll say turn Windows Features on or off you click on this and from here you should see SMB 1.0 sip support make sure this is checked so you can actually see what's going on so it's very important I honestly just go ahead and just take it like this and it'll actually support Samba shares so once you do that you hit OK it'll go through the install process and you're good to go but before I wanted to get into it I'm actually booting to my server now and test out the shares we created today I wanted to show that on a Windows 10 box just because it's very important to know exactly what you're getting into and always have that feature enabled almost every Windows box I get on if I'm connecting to Linux shares I put in Samba 1.0 on just so I can really get in there and I don't have to worry too much about the configuration we're gonna pull up our Windows box and see what we get my IP address is the 69.95 system and here is our test share which is currently empty let's go ahead and create a new file in here just to see what it does so we created this file Christa Titus Tech is awesome yay and we'll close that from there we have closed out I want to just double check and see test folder hello I just want to come take a look at what we created here so it went ahead and created that test file it assigned it just a standard to read the file but not write by default and obviously my users Titus which I can read write and execute that file so that's it for setting up a basic test share in terminal I wanted to get into actually assigning all of these but in the end it is just taking way too long to actually explain a lot of this a lot longer than I wanted I don't want this to be a 30 or 45 minute video so I'm gonna go into on another video and say advanced samba sharing and what I'm gonna do is tie into the existing users on this machine so let's say you had multiple users and you wanted to authenticate and do a lot of different things with those multiple users on the machine I'm gonna show you how to do that unlike an advanced Samba share however today this should appeal to 90% of you out there to where you can easily get in create these files edit these files from any machine and then come back to your Linux box and usually open up that folder and edit them and that's great it's so useful and honestly we didn't even need to create the test folder share we could have created another folder share and then put it in our home directory downloads and it would work just fine so that is samba sharing through terminal and then obviously earlier in the video that was the actual graphic user interface Nautilus which is Ubuntu's basic default file manager however you can install this on other systems so if you're using KDE or you're using another flavor you can always install the Nile this file manager switch over to it and do that GUI or that graphic user change just there without using terminal but these are the basic ways of setting up Samba shares in Linux you
Info
Channel: Chris Titus Tech
Views: 168,893
Rating: undefined out of 5
Keywords: linux, samba, file sharing, how to, how to set up samba for windows-linux file sharing, samba file sharing, linux file sharing, how to configure samba server in linux ubuntu, samba file sharing in ubuntu 16.04, samba (software), sharing, samba file server, linux how to, ubuntu (operating system), samba server, chris titus tech, how to setup samba, how to set up samba, how to setup samba server, How to setup linux file server
Id: oRHSrnQueak
Channel Id: undefined
Length: 17min 45sec (1065 seconds)
Published: Mon Dec 10 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.