Here’s my setup. I’ve got a large network that’s accessible by hordes of people. On this network I have an Ubuntu box acting as a file server for my tech & business website. I want a limited number of folks to be able to put files on it, take files off of it and access it from a number of different operating systems (OSX, Windows and Linux). How to do that? Well, the unix folks can use ssh and scp to connect and move files around (as can the more advanced windows folks :) )but for graphical sharing or mapping a network drive via Windows, we need Samba to get involved.

Put on your red cape, your spandex pants and your big “S” shirt. Then take a pic of yourself and send it to me. When you’re done doing that, we can install Samba.
sudo apt-get install samba smbfs
Now that we’ve got samba installed, let’s create a local user with which people can log in with.
Go to System-> Administration-> Users and Groups.
I created a new group (for this demonstration, I’ll call it newgroup) and a new user (let’s call it newuser). Add the new user to the new group. I’m not going to go through every step of the gui as it’s very straightforward.

Now that you’ve got a group and user, let’s give them access to your samba share.
sudo smbpasswd -a username
gedit /etc/samba/smbusers
Now, in the smbusers file that you’r editing, add the following:
username = “username”
Here, the first username represents the local user, and the second username, in quotes, represents the samba user. Save the file and exit Gedit.

Now you’ve got Samba installed and running, and are ready to create a folder to share. We’ll call this folder ShareMe for this example.
sudo mkdir /home/ShareMe
sudo chmod 777 /home/ShareMe
sudo cp /etc/smb/samba.conf /etc/smb/samba.conf.bak
sudo gedit /etc/samba.conf

Now, we’ve created the directory and we’re going to add a bit to samba.conf to let the samba know what folder it should be sharing, and to who. First find the line “security = usr” and replace it with:
security = user
username map = /etc/samba/smbusers

Then add the following to the bottom of the file:
[ShareMe] comment = Public Folder
path = /home/ShareMe
public = yes
writable = no
create mask = 0777
directory mask = 0777
force user = nobody
force group = nogroup

Now let’s restart Samba and give it a whirl.
sudo /etc/init.d/sambe restart
Once the daemon restarts, head on over to a windows machine and attempt to connect by going to Start-> Run and entering in:
\\pathtoyourcomputer\ShareMe
And that’s how to set up samba sharing.

geek out.

Share