How to set up a Samba Server for the ITL Lab.
Note that this assumes a Debian-based system...
First install the packages with apt-get install samba smbfs as root.
Now make a directory where you want the share to reside with mkdir /home/example and chmod it to
Next add a couple users. I recommend one for r/w and one for r/o. Do it (as root) with smbpasswd -a
<username>. I'd suggest something like guest as a password for the r/o account
Then open /etc/samba/smb.conf in your favorite editor (as root) and find the line that says ; security =
user and remove the leading ; (; acts as a comment in the smb.conf as well as #). Add the line
username map = /etc/samba/smbusers under it.
Then find the line that says workgroup = MSHOME and change it to workgroup = Itl.
Jump down to the Share section and find the line under [Home] that says writable = no and change it
to writable = yes
Right below that you will find create mask and directory mask entries. Change them both to 0775.
Now its time to actually do something. Skip down past the entries about the CDROMs (basically the
end of the file.
The first line defines what the share is called. You have to enclose it in square brackets. So in this
example it would be [Example]
Next line is the comment line, its format is comment = string.
After that is the absolute path to the share. So in this example it would be path = /home/example
Next is the browsable line. You want to make this yes, so people can browse the share. So in this case
it would be browsable = yes.
Then is the public entry. If you want the share to been seen by everyone, make this line say public =
Up next is the part that allows us to define who can write to the share. write list = <users> where users
are people who you have added with smbpasswd.
Below that is the line that allows you to restrict who can even read it, regardless of the settings. Its
formatted like valid users = <users>
Under that are the create mask and directory mask lines again. This allows you to redefine what
permissions files and directories get when they are created remotely...at least as far as I can tell.
Standard octal permission numbers are the argument.
At the end of this whole section are the force user = nobody and force group = nogroup lines. I don't
know what they are for, but the guide I was using said they had to be there. :D
Now you can finally save the file. Now run testparm as root to do a quick syntax check on your conf
file and to make sure Samba is going to parse it right. It will spit out how it parsed it once the syntax
check is completed so you can look it over. If its all good, then finally run /etc/init.d/samba start as root
to fire it up.