So you should know how to set up samba if you listened to the first MintCast podcast. But what if you ran into problems? I know I sure did. Here are some of the problems I ran into and what I did to fix it…
If when you right clicked on a folder you did not have the “Sharing options” go over to the mintMenu and then click on “Package Manager”. Put in your password and search for “nautilus-share”. You should only have 1 result so just check the box next to it and mark it for installation. Then click apply and you should be good to go.
I already had that option so the first thing that happened to me was when I right clicked on “Sharing options” I got this error.
“‘net usershare’ returned error 255: net usershare: cannot open usershare directory /var/lib/samba/usershares. Error Permission denied. You do not have permission to create a usershare. Ask your administrator to grant you permissions to create a share.”
I won’t go into the details of why this happens but if you get this problem you will need to edit a configuration file. Don’t get scared this is going to be easy.
There are two ways you can do this without opening a terminal and if you feel more comfortable check out a little how to on setting that up here. Otherwise open a terminal and type “sudo gedit /etc/group”. This will probably ask you for your password and then open gedit with a bit of stuff already inside. Be careful when editing this file! This file is what tells Linux Mint who can use what. I don’t just mean documents either. This tells Linux Mint if you can use your CD drive, hard drive, etc.
All we are going to do is find the line that starts with “sambashare:”. It is probably near the bottom so scroll down and when you find that line you will want to add your user name after the last : on that line. For example I had to add rothgar so my line looks like this now “sambashare:x:112:rothgar”. Once you add that user save and close the file. Log out and then back in. Now you have permissions to create samba shares on your computer.
This was the only problem I ran into when creating a share. If you had any other problems go ahead and post a comment and we will see what we can do to find a solution.
So now that we are past the problems now, so how do you get the most out of samba? To make this easy I use a tool called gsambad. To use this fire up your package manager and search for gsambad and install it.
Here is what mine looked like when I first started it up.
I know it is a lot of stuff and you don’t have to know what it all means. There are a few places you want to make sure you know what they mean though. First is the server host name. That is the name people can browse to your files assuming DNS works on your network (which it should). You can change your hostname there or under mintMenu -> control center -> network. Workgroup or domain should be whatever you workgroup is where you are using your computer. My workgroup at home is called shoppe and this can also be changed in control center. Allowed hosts and network is important because you will want to make sure the correct networks can browse to your files. My network at home is set up as 192.168.2.X so i had to add that to the list. My network at work is 10.10.133.X so I also had to add that too. Here is my configuration file after a few edits.
Everything under the “Server settings for advanced administrators:” we can ignore for this tutorial.
Lets look at our users tab. This says what users are allowed on your samba shares. You probably have 3 users listed here by default, your user, smbguest, and root. I would recommend creating users through control center -> users and groups and not through gsambad if you want more people to have access to your samba shares. The smbguest account is for everyone that doesn’t have a local account on your computer.
If you click on the shares tab you will see all the folders that are shared in your /etc/smb.conf file. A lot are there by default (home, printers, etc.) and these make getting the files you need easier.
But what about folders you right clicked on and did sharing options for like before? Those files are actually stored in /var/lib/samba/usershares/ as configuration files. Here is a configuration file for one that I set up earlier that didn’t show up in gsambad.
Sure you could just add more files in that folder and that will add more samba shares. Or you can still right click on folders and add them the GUI way, but personally I like setting up all my shares in gsambad or in the /etc/smb.conf file so that I have everything in one place. To add a share click the new share button. Type in the name of what the share will be (anything without spaces or symbols is good) and type in the path to where the folder is that you want to share. I am going to share another folder on my desktop called Banshee. To allow someone to veiw these files you will have to click on “Add access permissions”
Select where you want to get the user from and if you want to allow access or deny access and if you want to allow this user to write to the folder or not.
Select what users you want to have permissions and click import users. You will get a couple pop ups (just click close to get back to the main window). Once you are back to the shares windows scroll down to set if you want your share to be read only, writable, etc.
If you set the share to public than you won’t have to put in a username or password to connect to the share. This isn’t good for your home directory. But if you want a public spot for anyone to drop files or get files from you you should make it public.
As soon as everything looks good just click add at the top and your new share will automatically be written to the smb.conf file. If you ever need to edit the share you can just come back to this tab and change the settings you want changed then click apply at the top.
You probably won’t use any of the other tabs in gsambad except maybe the configuration tab. This tab just shows what the smb.conf file actually has in it. The other tabs can edit this file for you through the GUI but if you want to do it manually you can change that on the configuration tab.
I hope this helps you get on track with samba and how to configure it a little more. Let me know if you have any questions in the comments or send me a email.