Sunday, January 07, 2007

SAMBA! Part 2, adding shares

This is the second part of the instructions for setting up samba (SMB) windows file sharing on Ubuntu Linux. You can go here for the first part, where we added samba and turned it on.

More instructions can be found here.
Open the terminal, and type this in:
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup
English translation:
sudo = temporarily give me more user privileges
cp = copy 1 file to another file (in this case, we are copying smb.conf to
so we can revert to the old settings if we need to).

If you did it right, the terminal will not give you any response.
If you want to check it, you can go to /etc/samba/ and make sure the two
files are there.

Now, we want to actually edit the smb.conf file:
gksudo gedit /etc/samba/smb.conf
This is one of the most surprising things about Linux, and I think it's
very telling. In windows, it's kind of every man for themselves -
each software company does things their own way, whichever way is
most cost effective for them.
In Linux, there are some fundamental conventions that programmers follow.
Usually, but not always, there is a small file that gives you tons
of features and minuscule control over every aspect of a program.
It is a simple text file that usually has a .conf extension.
Programmers could trust you to edit the source yourself, since most
programs are open source, but then you would have to redo all your
work every time you upgraded. It's simple, elegant, and very common.
Combined with man, .conf files are one of my favorite thigs about linux.

Find the "workgroup = MSHOME" line under global, and
change MSHOME to whatever the name of your workgroup is.

Find the "; security = user" line under Authentication, and change it to this:
" security = user
username map = /etc/samba/smbusers"
The semi-colon comments out the line so it doesn't work.
We want username authentication to work, and we also want to
map usernames to the smbusers file.

We need to make three changes in the share definitions section:

uncomment the
"[homes] comment = home directories browseable = no" lines
uncomment the "valid users = %s" line
Find "writeable = no" in the Share Definitions section,
and change it to yes.

save your changes, close smb.conf, and type
"sudo testparm" in the terminal.
Sudo testparm will test smb.conf and make sure everything is correct.

If you don't have any errors, you can restart samba with a
"sudo /etc/init.d/samba restart"
init.d is a text file that holds initialization and termination
files for many programs.
The above command basically asks the init daemon to stop and start
samba for you.

A daemon is a unix term for a program that runs unattended.

If you want to change the name that appears in your workgroup for
your new fileserver, open back up the smb.conf file and look
for the "server string" line. Change that line to whatever
you want. %s is the name of the computer you used during install.

Labels: , , , , , , ,


Post a Comment

Subscribe to Post Comments [Atom]

<< Home