Brief Introduction to Samba

Below please find a brief intro to Samba, and instructions for setting up your own samba server and windows client:

First off you should download the Samba  It is an easy to read guide which will get you up and running in no time and covers the latest release which is 2.03. Note you can use xpf to view it. 

Samba is an implementation of Microsoft's file and print services that runs on Linux and many other UNIX's and also Novell platforms. What the Samba team did is basically reverse engineer some of Microsoft's protocols so that there is an alternative to buying the overly expensive Windows NT product. This is very useful for people who have windows clients and want to be able to network without buying windows NT. Once properly configured a Linux box running Samba will look just like an NT server to all clients including other NT servers. Recently with the advent of version 2.0 Samba also acquired the ability to act as a PDC in a windows NT domain. It shows up in NT server manager just like an any NT server would. While it is not advisable to completely replace all of your NT servers yet you can save a lot of money by replacing some of your NT servers with this great program. Also with the advent of 2.0 you can administer Samba from a web browser with the SWAT interface.  Even in a small home network with 2 or 3 computers, your Linux box can make life easier for you in that you can back up files directly to the Samba server, and also have it act as your print server. 

There are two parts to this setup. 

First is the linux part, then is windows part, below is how to do both of these setups. Chances are you already have samba installed. On rpm based distro's type rpm -q samba. If you get nothing mount your distro cd and type rpm -ivh samba* to install it. 

Now, let the fun begin, below I have listed a sample smb.conf file that you can use to set up samba as a Primary Domain Controller for your home or business network. The example below can be used as is, the only thing you may want to change is whether you use a login script or just make the shares available or both. I like using logon scripts, but if you don't want one, just comment out the lines that relate to the logon script on netlogon, then make the Homes Directories or whatever directories you create browseable. If you are going to use a logon script you have to actually created a logon script. Mine is called startup.bat and the text inside it reads "net use f: \\servername\share" without the quotes. So if your server name was redhat and the share name was root, you would say net use f: \\redhat\root in the logon script. 

The last thing you need to do is make sure the user(s) you want to use are set up. This is done with the smbpasswd command. For example say you have a linux user named fred whose linux password is 123456. Since samba uses its own method of authentication you need to add a password for fred in smb format. To do this type smbpasswd -a fred, then type in the smb passwd you want fred to use when he logs on I suggest his linux password which in this case is 123456. 

Once this is done and your script is all set up on redhat/mandrake systems cd to /etc/rc.d/int.d and type ./smb start as this will start your smb server and give you feedback on whether it started ok. The smb.conf file is re-read occasionally, but if you made a change to the script and want to make sure the running samba daemon picks it up, cd to /etc/rc.d/init.d and type ./smb restart. 

I recommend backing up you smb.conf file and starting clean with this example as the many options in there will likely just confuse you, well it confuses me anyway. 

[global] 
security = user 
workgroup = MADEUP 
encrypt passwords = Yes 
min passwd length = 6 
smb passwd file = /etc/smbpasswd 
#logon script should go in netlogon directory 
#below you will find a example of this 
logon script = startup.bat 
domain logons = Yes 
domain master = Yes 
preferred master = Yes 
server string = Samba Server 
#load printers = Yes 
#printcap name = /etc/printcap 
[homes] 
    comment = Home Directories 
    browseable = no 
    writable = yes 
    readonly = no 
    available = yes 
    public = no 
    only user = no 

[root] 
    comment = root directory 
    path = / 
    browseable = no 
    writable = yes 
    readonly = no 
    available = yes 
    public = no 
#   only user = no 
#   used to say valid user not users! 
#   can also be @group where group is a valid unix group 
#   example valid users = @users 
    valid users = root 

# Un-comment the following and create the netlogon directory for Domain Logons 
#remember you must have specified the name of your script above! 
[netlogon] 
    comment = Network Logon Service 
    path = /home/netlogon 
    guest ok = yes 
    writable = no 
    share modes = no 
    available = yes 
# Un-comment the following to provide a specific roving profile share 
# the default is to use the user's home directory 
;[Profiles] 
;    path = /home/profiles 
;    browseable = no 
;    guest ok = yes 
# NOTE: If you have a BSD-style print system there is no need to 
# specifically define each individual printer 
#[printers] 
#    comment = All Printers 
#    path = /var/spool/samba 
#    browseable = no 
# Set public = yes to allow user 'guest account' to print 
#    guest ok = no 
#    writable = no 
#    printable = yes 

Now that the linux part is done you need to set up the windows machines. Right click on network neighborhood and select properties. If client for microsoft windows networks is not there select add--> client-->Microsoft client. Once this client is added you can select properties for it and put in a domain name that matches the name of your workgroup in your smb.conf script. Then check log onto domain. That's it, you may have to reboot for the changes to take effect. Upon reboot logon as the the user you created and added a password for in the smbpasswd utility, and put in the name of your domain. You should now be logged into you samaba server. 

One last tip. If your at a linux box and want to access a samba server or NT server for that matter, first make sure your are a valid user, then type smbmount //servername/sharename /mountpoint. So if my NT or samba server name is server and the the share name is apps and my name is fred. I would type smbmount //server/apps /home/fred/share assuming the you have actually made a directory called /home/fred/share.

Have a Linux Problem
Linux Forum - Do you have a Linux Question?

Linux Books
Linux Certification, System Administration, Programming, Networking Books

Linux Home: Linux System Administration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.
The site www.gotothings.com is in no way affiliated with or endorsed by any company listed at this site.
Any unauthorised copying or mirroring is prohibited.