How To Set Up Easy Samba File Sharing in PCLinuxOS
by David Lally (sarcastic_bastard on linuxgator.org)
Ok, we seem to have a few people asking this one, and rather than me keep repeating it (even I get tired of repeating the same thing 300 times), I figured it might be an idea to throw up something a little straight forward for you lot. This method will enable you to set up Samba Shares (similar to windows file-sharing over a network) without needing to use passwords, but there's nothing stopping you setting it up with passwords either. It's just that I'm sure most folk would like simple file-sharing enabled in their home network, for ease of use. Either way, the basics are the same.
Now, I've found myself doing this in 2 slightly different methods before in the past, both achieving the same result. But one requires an extra step, but for a reason. Bear with me here.
It's a good idea to make sure all needed Samba packages are installed first, so open up Synaptic (your package manager), and ensure Samba Client and Samba Server are installed.
The Direct Method
Now, the straight-forward method is as follows. Go up top to System, then Administration, then Configure Your Computer (PCLinuxOS Control Center). I usually select to "Add This Launcher to panel", since it saves time later when you want it. In here, select Network and Internet, then Manage Hosts Definitions. By default, mine (and yours) will show an IP Address of 127.0.0.1, and a hostname of localhost. This always gave me grief when trying to set up Samba, until i worked out I needed to change this. Either double-click on the line with 127.0.0.1, or click on it and select Modify on the right. Same result either way. Leave the IP Address bit alone, but where it says Host Name, change it to something you would like your PC to be seen as on the Network (there's a little more to it, but this is just simpler), such as Bob, Truck, Matt's PC, etc. Give it a distinctive name. This is what it will show up as on the network when connected and sharing with other PCs. Mine is named Xero. Then, when you've done that, and before closing it off, write "localhost" in the line below, where it says "host aliases". Click OK, and now you will see your PC with it's new name, and localhost off to the right where there was nothing. Click OK at the bottom again, and close off so that you are back at the PCLinuxOS Control Center again.
Down the left hand side again, choose Sharing from the top, then Set Up A File And Print Server. If Samba is not already installed it will prompt to, and install itself. Next, it will walk you through the configuration. Unless you need something more than basic, such as working with a domain (which i know nothing about anyway, so we'll leave that), choose Standalone at the bottom, and click next.
Now, you need to select the Workgroup name. All the PCs in the network must share the same workgroup to see each other properly. By default, Microsoft OS's usually choose either MSHOME or WORKGROUP as the workgroup, so if you are expecting to connect with Windows PCs now, or later, this is where to change it. If all the PCs are just running PCLinuxOS, or Mandriva for that matter, the default of MDKGROUP should suffice, but you can also change it to something else, such as WORKGROUP, or PEACH, or whatever you like really. But all the PC's will need to use the same workgroup name. That is all you need to really worry about.
The line under that says NetbiosName, and you can either add your PC's name (eg. Xero) there, or change it to something else you might want it seen as on the network, or, since we've already named it previously, you can just leave it blank, and it should default to the name you gave it previously. You really don't "need" to fill this in as your PC already has a name, but it if you prefer, or want it to be seen on the network as something other than what we named it before.
You can basically click next all the rest of the way thru this, til it's done. Any basic network will be satisfies with the defaults, and you'll be told you've "Successfully Configured your Samba Server", at which point you can click Finish at the bottom right, and it should close off, leaving you back at the PCLinuxOS Control Center.
Now, you should (in the PCLinuxOS Control Center) go to Mount Points, and select Set up Sharing of your Hard disk partitions.
Here it will ask how you how you want to setup allow users to share directories. You can set it so no-one can share (defeating the entire purpose of this), allow everyone (allowing all users to share folders as they wish to define), or Custom (allowing you to setup custom permissions, as to who can share, and what). For a simple home-network, I suggest just choosing "Allow all users," hit OK at the bottom right, and making sure SMB is selected, then hit OK again. You'll find yourself back in PCLinuxOS Control Center (again).
Now that the Samba server is set up, and configured, all that is left to do is to define our "shares". There is basically 2 ways I can suggest to you (as these are how i have successfully done mine before). I should point out that I have my OS's (XP, and PCLinuxOS Gnome, with XP not being booted in months) on my first primary drive, and I have 2 other drives I use for storage. Both are formatted as ext3, but if yours are formatted as FAT32 or NTFS, it should make no difference. You may need to allow or set up write access to the NTFS partitions, but reading from them should be fine either way.
With my drives set up as they are, I can either set up shares through the PCLinuxOS Control Center, under Manage Configuration of Samba, or I can use the "right-click" option when clicking on folders, and choosing "Share." This second option will only work for folders in your /HOME/USERNAME directory. If you prefer the simplicity of the second method, but, like me, your data is on drives/partitions other than your /home, there is a way around it. It is also best recommended if you are the only user for your PC. Otherwise, the other way is recommended, as others won't have access to them as they'll be in YOUR home directory.
I want to share certain folders off my drive/partition, but don't want to share the whole thing (I do have private stuff there also). If i want to just be able to right-click on it to share, the simplest way to accomplish this is to un-mount the partition and remount it under my /home directory. It isn't hard at all. Just do this. In the PCLinuxOS Control Center (yeah, we do everything from here, I wish others had it, it makes life so much easier), select Mount Points again, then "Create, delete, and resize partitions". Click on Continue from the bubble that pops up. Now, you'll see your hard drives and their partitions listed. To mount my 2nd drive (hdb on the top tab) under /home, I click on the tab to select it, then click on and select the partition, and choose the "Unmount" button that appears down the left (make sure you aren't doing anything on it, or it will throw up an error, as you can't unmount it while it's being used). The drive is now no longer mounted, and is currently inaccessible. Now select "Mount point" from the left-hand options. It will show you the last listed mount-point for the drive, such as /mnt/hdb1, or in my case (I already changed the name to something more recognizable) to /mnt/300GIG (it's a 300 GB drive, making it easier to locate since I know what is saved to what drive). To mount it under /home, we change this to /home/yourusernamehere/namewechose for partition (eg. /home/david/300GIG), then click OK, and select "Mount" from the left hand side options. Your drive/partition is now mounted under /300GIG in your home folder. If you look in your /home directory now, you will now see a new folder, named 300GIG (or whatever you chose to call it). Repeat this for any drives/partitions you wish to add this way. Click Done at bottom when finished. Remember, this is only suggested if you are the only user on the PC, as others won't have access to your /home directory.
Using PCLinuxOS Control Center
Now, the other "official" way, particularly if the PC is multi-user, is to, in the PCLinuxOS Control Center (beginning to see the pattern here?), and select "Manage Configuration of Samba". If we chose "Allow all users" then we won't need to create any users, it's all straight-forward. On the first tab, File Share, clcik on Add on the far right, and a box will appear. Now, as we "haven't" moved things to /home (which is why we're doing it this way), my drive/partition is still mounted under /mnt/300GIG (though yours might be /mnt/hdb1, or something similar, it's best to be sure you know which first), under "DrakSamba Add Entry" there are 3 boxes to fill, and an "open" button to the right. Click on the "Open" button, and it will open in your /home directory (mine being /home/david).
Now, there are 2 columns, and a series of buttons above them. One button shows my /home/david directory listed, and has up/down arrows on it. Clicking on this button shows me 3 options, /home/david, /home, or / . Click on /, and you will find yourself navigated to the / (or root directory), where everything else can be found. Find /mnt, and double-click on it, so that now you can see everything in /mnt, such as my 300GIG (or whatever yours is called). Select this 300GIG, and you can choose to either share this entire drive/partition, or double-click on and open it, then select which folders inside you wish to share. I will choose, for example, my MOVIES folder, and double-click on it to open and display it's contents. Now that you have opened it, it is now selected. At this point, you can simply click on OK, and find yourself back at the "DrakSamba add entry" box, but now with the share directory listed at the bottom . Now, at the top line, "Name of share", call it what you wish it to be seen as on the network, MOVIES for example. Underneath, in Comments, I write MOVIES again. I've tried not filling comments in, but it complains, and asks me to enter a comment for share. Can't continue without it, so I add the name again, or at least something else to describe what's there. Click OK. You've now created a share. To add more, click on Add at the right, and repeat with any other folders/partitions you wish to share. Once you've chosen them, click OK at the bottom.
All your shares should be showing up now on the network. If not, then, back in PCLinuxOS Control Centre, click on System, and then "Enable or Disable Services". Check that Smb is marked as running, and make sure now has a check in box to start at boot. If your network shares are still not showing on the network, click on Stop next to Samba. Then after a few seconds choose Start again. Give it a minute, and it should now show. If it still fails (rare), then a reboot should fix it, and everything should work perfectly.
I currently don't have a working switch to connect my PCs with and test this, as it's mostly from memory, but it should all be fine. Feel free to point out if I missed anything, I can edit to add it in. Like I said, working from memory, pretty sure, but it's possible I've missed something. If it still isn't working correctly, go back into the PCLinuxOS Control Center (after a reboot preferably) and into Mount Points, then Manage Configuration of Samba, and where your shares are listed, double-click on one, or click modify to the right, and Choose to make the share Public, or Browseable, by clicking on the box marked so and activating Yes. Then click on OK and close off. It should be fine. Please tell me if I'm missing anything, and i'll amend it. Hope this is of help to those feeling lost when setting up Samba file sharing.