How to Make an Ubuntu File Server With Samba

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys david here from googoo 255 tech tutorials and today i'm going to be showing you how to make in a bunch of file server ok so let's get started so basically what we're going to be doing here is we're going to be making a file server using a boon to server which will allow users across Windows Mac and Linux computers to access the files all over the network so like I said we are going to be using Ubuntu server for this so what you're going to want to do is you're going to want to go ahead and go over to giunta's website and download a copy of ubuntu server make sure that it is a boon to server and not desktop desktop will take too much space on the hard drive anyways so let's get started so the first thing that you're going to want to do is you're going to want to burn the ISO image that you downloaded from Ubuntu calm move a boon to a server to a disk and you're going to want to boot it up on the computer that you want to turn into your file server when you get here select your language and click on install ubuntu server ok you'll be greeted with this choose your language obviously I'm going to choose English choose your country I'm in Canada now here it's going to ask you if you want to detect your keyboard layout I'm going to click no you can click yes but if you already know what it is you could click no one to select it mine is in English us keyboard which is the standard for the West ok now when you get to this window it's going to ask you for a hostname basically like it says here it's a single word that identifies your system to the network so I'm just going to name this one go Gouda server once you've typed in a hostname just click continue and you're going to need to create a new user so enter person's name or whatever you choose then the username for the account and then you're going to need to make a password on the account that's going to ask after you make the password if you want to encrypt your home directory since this is a server it's probably a good idea to say yes to this so that your information stays secure now it's going to ask for your time zone you can go ahead and set the city that is closest to you so for me that would be Montreal so this is where most Linux geeks are going to disagree with me most of them would probably tell you that it's best to have one hard drive for the OS and another one for the files on the file server I'm just going to be using the exact same hard drive for both so what I'm actually going to do is I'm not going to choose any of those I'm going to choose manual and I'm going to go ahead and click on the current hard drive it's going to say create new empty partition table on this device I'm going to click yes okay now I'm going to go down here and click on the free space and I'm going to click create a new partition now I'm going to subtract two gigs because I want to gigs later for a swap partition so currently wants to make a partition that is the full amount of the hard drive I'm just going to go ahead and - two gigs from that so I'm going to go one oh four gigabytes that's going to be our root partition where we are going to install the OU unless you are using a proxy to access the outside world type for the new partition we're going to choose primary location beginning and nothing in here needs to be changed except for the bootable flag you can just change that to on real quickly when you're done you can just click done setting up the partition and you'll see that you'll still have some free space so go ahead and click on the free space skin click create a new partition this is going to be our swap so two gigs is enough for a server continue type the new partition logical and um we're actually going to change the use as to swap area and once that's done you can click done setting up the partition okay so once you've done that you can click finish partitioning and write changes to disk it's going to confirm the changes just hit yes and this will erase anything that is currently on the disk okay now it's installing the base server system when this comes up just click continue when this comes up you have a few choices I'm going to choose to install security updates automatically just to be safe but if you know what you're doing you can click no automatic updates or manage system with landscape when the software selection window comes up just leave it blank for now we are going to install a few of these things here but for now I'm just going to leave it blank because we want to make sure that we have the most updated versions and there's no point in installing it now and then having to update it later so for now don't install anything and just click continue it's going to ask you if you want to install the grub boot loader to the Master Boot Record just go ahead and click yes because I'm assuming that this computer that you're installing this on is being used as a server and nothing else if you did have Windows installed however and you did partition it for a dual boot system you don't want to click this if it's the only OS on the hard drive then it's ok to click yes ok now a boon to server is completely installed so you're going to want to remove the CD or USB key that you use to install it and then just hit continue and your computer will reboot into the server okay when you're brought to here you're going to want to login with the username and password that you made during the setup okay so the first thing that you have to do once you're logged in is you have to enable the root user so what you need to do is you need to type in sudo pass WD for password root that's going to ask your password type in your password and now it's going to ask for your password for the new root account so type in a password for root and it should give you that the password was updated successfully okay so now we're going to work on actually getting our server up and running so that our Windows Mac and Linux computers can all connect to it and share files so a server should always have a static IP address so that's what we're going to do first so the first thing that you're going to need to do is you're going to need to type in su and then type in the root password that you made earlier this will just give us full access to everything on the server next you're going to want to type in if' config okay so this is going to show all the network cards that are currently being used on your computer you can see here eth0 for ethernet 0 this is what is connected to my router at the moment so what you need to do is you need to take note of the B cast number and also the mask number the be cast for me is 192.168 to 255 and the mass number is 255.255.255.0 just take note of those two things there so now we're actually going to go ahead and set up the actual static IP address so what you need to do is you need to type in VI slash et Cie slash Network slash interfaces and hit enter you will be brought to here you need to scroll down under Auto easy R o you'll see I face 0 I net DHCP go all the way to the end of that and then hit insert on your keyboard change the DHCP to static next you can hit enter hit space and then type in address and then give the computer an IP address so in my case I'm just going to be giving it 192.168 to diet 34 that's going to be the IP address of this server specifically and it's never going to change since it's static next I'm going to do netmask again with the space in front of it netmask it's the same netmask that you wrote down earlier or took note of enter space network for the network you're going to want to type in 192.168.0.0 for the broadcast once again type in what you wrote down earlier and then for the Gateway the Gateway is normally the IP address of your router standard IP addresses are 192.168.0.1 and 192.168.1.1 mine however is 192.168.1 if you're not sure you can type in 192.168.0.1 as that is the standard and if it doesn't work you could come back later and try different ones once you've written all that press escape on your keyboard type in a colon and then type WQ this will just write it and quit it now we need to restart the network so we're going to type in slash ET c / i and i TD slash networking space restart and that will restart the network ok now we need to update the package repository so we're going to do that by typing an apt - get update this is where you should see if you configure your network correctly if you're only getting errors you did something wrong and you need to go back and fix it ok so when it's done we're going to upgrade the system just in case there are any important upgrades type an apt - get upgrade and that'll upgrade our system to the newest one so it says that it needs to get sixty one point nine megabytes of archives when it asks if you want to continue hit yes and just wait for it to upgrade okay so once the system is done upgrading now we actually have to install the server components so what you need to type in is apt - get install and we're going to install the OpenSSH server in case you want to manage the server remotely by SSH into it so open SSH - server so we're going to install samba that'll basically be the root for our server so samba we're going to install SMB client we are going to also install CIFS - utils you need to install MTP and NTP date those two last packages will just basically keep the date and time on the server so once you've typed all that in just hit enter and when it comes up asking if you want to continue just type in y and hit enter okay now instead is done installing all of that we're going to start making the shared directories so the first thing I you're going to need to do is you're going to need to CD to the root to the hard drive so you just type in CD and hit enter and that's CD to the root of the hard drive now you need to type in mkdir slash files in this directory is where we're going to put all the shared folders all the folders that we're going to share over the network so I'm going to be making two folders now there is no limit to how many folders that you can actually share over the network here I'm just going to be using two but keep in mind that if you want to make more you can just follow the same steps over and over again until you make as many folders as you'd like so in that files directory is where we're going to be putting the folders that we're going to share over the network so I'm gonna make one folder called public so type in mkdir slash files slash public that makes the public folder in the Files directory and I'm also going to make another one called David so mkdir slash files slash david hit enter and now we need to change the permissions of those folders so that they're readable and writable by everybody who has access to the server so you need to type in CH mod space 777 and then the directory of the folder so in my case files slash public hit enter and you have to do that for every single folder that you make so chmod 777 slash files slash David under okay so you're going to want to pay a lot of attention during this part here because this part is what's either going to make or break your server so now we need to edit the Samba configuration file to share those folders so what you need to do is you need to type in VI space slash et Cie slash Samba slash SMB conf hit enter and this is the Samba configuration file so do just as I do here so scroll down a bit until you get to the workgroup setting it insert on your keyboard so that you can edit and delete the workgroup now this part is probably the most important part if you already have a workgroup set up in your house you're going to want to give that workgroup value the same name as the workgroup that is existing already in your house if there isn't one you can type in a name here and we can join the windows computers to that workgroup later which I'll show you how to do in a minute me I'm going to type in go Gouda as my workgroup sometimes computers also just have the workgroup name as workgroup so if that's the case you can also leave that there but just make sure that all the computers that are going to be connecting to this server are on the same workgroup that's especially important for Windows computers keep scrolling down remove the hashtag in front of wind support and then change the value from no to yes up here remove the semi-colon in front of name resolve order remove the hashtag in front of security equals user under authentication everything under domains can stay the same also under printing unless you want to setup a print server and you're going to want to go all the way down under the shared definition subtitle once you're all the way at the bottom and you can't go any further this is where we're going to start putting in the folders that are going to be shared over the network start doing that you're going to need to type in a square bracket and then you need to type in the name of how you want the folder to appear to other computers on the network so in the square bracket for the first one I'm going to type in David David's files close the square bracket hit enter hit space comment equals David's files you can just make it the same as what you put up there path equals now this is where you're going to put the directory of the folder so I'm going to type in file slash David because that's the folder that we made that's the folder that's going to be shared over the network hit enter space browsable equals yes read-only equals no this will allow you just to write to it you can also write yes here if you want but it's completely up to you next we're going to do the next folder so I'm going to name this one public files it enter space comment equals public files path equals slash files / public browsable equals yes read-only equals no okay and you can just basically keep on doing that for as many folders as you would like to share over the network so once you've put in all your folders all you have to do is hit the Escape key on your keyboard type in a colon and type in WQ that writes it and quits hit enter and there you go now this hammock configuration file is written so now we need to add a Samba password because some computers will ask you for a password when you try to connect to the server so what you need to do is you need to type in SMB pas s WD a and then a username I'm going to be doing David here and it's going to ask you for a password type in your password and it should say that it added the user okay so now to actually activate the Samba server we're actually going to restart the computer here so go ahead and restart your computer okay so once the server has completely restarted you don't need to login or anything it should be activated so now I'm going to be showing you how to access those folders on the server in Windows the first thing that you're going to want to do is make sure that you're on the same workgroup as the work group that you specified in the Samba configuration file to do this you could go to start right click computer hit properties and this window here should come up you could see the workgroup name over here now in my Samba configuration file I specified the workgroup go Gudda so we have to change that so if your workgroup isn't the same here you can go to the change settings on this side over here when this comes up hit change and change the workgroup to whatever the name of your workgroup is it ok and it's going to tell you that you have to restart the computer in order for the changes to take effect so once it does that just restart the computer and we'll go from there ok now once your computer has rebooted you can access the server by going to start computer and in the side here you should see Network click on network and the first time around it might take a little while for all the computers in here to actually show up so just be patient but after they do all show up you should see your new server in here so you can see here we have a computer called Gouda server that's our Ubuntu server so you could double click it and you can see the two folders that we made earlier are being shared in here so just as an example I'm going to go ahead and save something in here so I don't know I'll just put a text document that's in the David's files folder and then I'm also going to do that in the public files except I'm going to maybe put a zipped folder just change it up a bit and you'll see that we're able to access those on other computers in Mac OS X if you want to access the shared folder all you have to do is hit go and find her go to network and the computer should show up in network you can see that we have Goguryeo server over here so you could double click it and it'll say connecting now like I said for Mac and Linux computers and sometimes windows 2 you need a password to connect so you can see that we're connected as guest but if I try and open the folders it doesn't work so this is where you click connect as up here just make sure registered user is checked and you can type in the password that you specified when you did the Samba user add command and you can also remember the password in your keychain if you want so hit connect and now we can open the folders and you can see we have the new text document that we created in windows in the David's files and the new zip file that we created in the public files folder now if you're using Linux it varies from distribution to distribution but I'm assuming that you're going to be able to figure it out if you're using the KDE desktop environment if you open up dolphin there should be a place in the side bar called networks and if you open that up you can explore through all the networked computers in there ok so now I'm going to show you how to make it so that only certain users can access certain folders if this is what you want to do so once again you are going to want to type in su on your server and then type in the root password and for this example I'm just going to be making a new folder on the share called test so I'm going to go ahead and do that ok you're going to want to go ahead and open up the Samba configuration file again so you can do that by typing in VI slash et Cie slash Samba slash SMB conf next you want to scroll down all the way to the bottom where you specify these handba shares for the server okay I'm going to go ahead and put in the test folder that I made earlier so I'm going to name it tests files okay so now we're going to set it up so that only certain users can access it so I'm going to start off with the David's files up here let's say I only want a user who authenticates themselves as David in Mac or Linux or in Windows they log in as David to be able to access this folder what you need to do is you need to add another line that says valid users equals and the usernames of the people that you want to be able to access this folder you can add more than one but for this I'm just going to add one so for this one I'm going to add valid users equals David and let's say I had a user name by the name of test on a Windows computer I'm also going to add down here valid users equals test what this basically means is any user that authenticates themselves as David can access David files public files but not tests files whereas any user that authenticates themselves as test can access tests files and public files but not David's files you'll see what will happen in just a minute if I try and access those from a Windows computer when I'm not allowed ok so once we've gone ahead and put in all your valid users hit escape type in a : WQ hit enter ok now for this to work we have to make sure that the valid users have user names in the Samba password directory and also on the abun to server now I already have a user account called David in here which I set up also a Samba password for so for this I'm going to be doing this for tests so the first thing that you need to do is you need to actually go ahead and create a user name called test or whatever other value you put in there for valid users on the server itself so you could do that by typing in user add and then a user name so user add test now you need to give it a password so pa sswd test and you need to make this the same password that they'd use on Windows computers so if you already have a user called test on a Windows computer make this the exact same password so I'm going to go ahead and do that okay so once the user is added into the Ubuntu server you also need to add it in the Samba server so you could do that by going SMB the a sswd a and then test I'm just going to ask you for a new password again same one that you used up there and for on and the same one that is being used on your windows computer and it should say that it added the user successfully snakey could go ahead and restart Samba or even easier just for start the computer and I'll demo what this does in Windows and on Mac in a minute okay now in Windows I'm logged into an account called David with the exact same password that I set up on the Ubuntu server now you can see here that I can access David's files I can also access public files because I didn't specify any valid users but if I try to access test files I have to give a username and password and since the only valid users that we specified for tests files is test if I type in the tests username and password I'll be able to access it but without the username and password there's absolutely no way you could get into that ok so on Mac it's the same as in Linux so I'm not going to show you in Linux because it is the exact same thing but right now I'm connected as David so if I open up David's files I can open up David's files I can open up public files but if I try and open up tests files I'm not able to now if I authenticate myself as test by going disconnect and then connect as up here now if I go ahead and authenticate myself as test you can see that I can access tests files public files but I can't access David's files so thanks for watching and I hope I helped this is kind of a confusing video so if you have any questions or comments leave them in the comments box below don't forget to Like and subscribe and check out my website for more a goo goo 255 tech tutorials comm also don't forget to check out my Facebook and Twitter page all the links are in the description below
Info
Channel: goguda55 Tech Tutorials
Views: 289,630
Rating: undefined out of 5
Keywords: ubuntu, tutorial, server, linux, samba, windows, mac, desktop, computer, network, file server, file, gnu, terminal, os, os x, apple, microsoft, software, install, visual, router, ip address, authenticate, laptop, distro, kernel, debian, canonical, kde, gnome, opensuse, share, smb, Technology, System, tech, internet, freeware, help, how to, Basic, Program, application, programming, code, screen, GUI, security, configure, dhcp, static, Management, link, lxde, command line, free, Data, folder, directory, partition, hard drive, ssh, wins
Id: ndAYZ0DJ-U4
Channel Id: undefined
Length: 27min 29sec (1649 seconds)
Published: Wed Jun 26 2013
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.