S_Serve
Here are my notes for using Samba to make a linux box a member of a Windows NT4 domain. In the domain, the roles of Primary Domain Controller (PDC) and Backup Domain Controller (BDC) are performed by Windows NT4 Servers. The clients in the domain are all Windows XP Professional.S_Serve plays the role of file server in the domain, is running Debian 3.1 (Sarge), and has the following specs:
- Intel Celeron 500Mhz
- Intel i810 chipset (onboard video and audio)
- 96MB PC100 SDRAM
- 40GB IBM Deskstar EIDE HDD
- Netgear FA310TX 10/100Mb PCI network card
- Netgear GA621 (National Semiconductors 10/100/1000Mb fiber optic network card)
(written 2/4/2005)
Making Samba a Windows Domain Member Server
The name of the domain is "Robots", the PDC is named "PDC", and the BDC is "BDC".The following are the steps that I followed after performing a basic install (no x-window or anything) of Debian 3.1. These instructions assume the reader understands how Windows NT4 domains work, and has access to a domain account that has administrator rights. I would like to thank Brandon, who showed me how most of this stuff works.
- I wanted a Windows share with the name "users", which shared the /users directory. So, first I needed to become the root user, and then create the directory.
sucd /mkdir users - In my case, I wanted a separate volume mounted at /users. So, I have to edit the fstab so that it'll get mounted automatically in the future
nano -w /etc/fstab
Then I added the following line:
/dev/hdb6 /users xfs defaults 0 0 - Now mount the volume
mount /users - Next, make sure the permissions on this new directory are set properly
chmod -R 755 /users
Note: I tried initially doing a "chmod -R 744", however that doesn't work, and Windows users can't access the share. Everyone needs executable permissions, so you need to use "chmod -R 755". - Now that's out of the way, so all we have to do is configure Samba. Install the samba package
apt-get install samba
You will be asked a series of questions that I answered in the following way:workgroup/domain = robotsencrypted passwords = yesmodify smb.conf to use WINS settings from DHCP? Norun samba as a daemon or inetd? daemoncreate samba password database? No - Backup the original smb.conf
cd /etc/sambamv smb.conf smb.conf.original - Create a new smb.conf
nano -w smb.conf
And add the following lines:#Global parameters[global]workgroup=ROBOTSserver string =security = DOMAINpassword server = pdc, bdcwins server = 129.22.4.10ldap ssl = noidmap uid = 10000-20000idmap gid = 10000-20000template homedir = /users/%U/template shell = /bin/bashinvalid users = rootadmin users = robots\administrator, robots\systemcreate mask = 0777directory mask = 0777map acl inherit = Yes[users]comment = All the stuffpath = /usersread only = No
This file defines a lot of parameters, most of which are self-explanatory. For instance, "password server = pdc, bdc" sets the PDC and BDC as the servers that can authenticate user accounts. The "admin users" defines two Windows Domain accounts that get mapped as root users on this server. And it defines a share called "users", which users are allowed to access. - Now restart the samba services
/etc/init.d/samba restart - Add the samba server to the Windows domain
net rpc join -S pdc -U administrator
Note: Following the -S, you should enter the hostname of the PDC. Following the -U, you should enter the name of an account that has the rights to add a computer to the domain. After entering this command, you will be prompted for the password for that account. If successful, you should see a message that says something like
Joined domain ROBOTS. - Now you'll need winbind so that the authentication can be passed to the domain controllers. Install the winbind package
apt-get install winbind - Modify the nsswitch.conf so that winbind gets used by the name service switch
nano -w /etc/nsswitch.conf
Then append the first two lines so that they look like the following:
passwd: compat winbindgroup: compat winbind - Now test to see whether winbind is working properly
getent passwd
This should return a whole bunch of accounts, including all of the Windows domain ones. Assuming that it is working properly, you should be able to use a domain account from another computer and access the "users" Windows share on this samba server.
That's it. Of course, users won't actually be able to write or create anything in that Windows share.
- A script was written by Brandon to create directories and set the permissions correctly. A profile directory is created in each user's directory to hold their roaming profile contents.
nano -w /root/userdirs
The script has the following contents:
mkdir /users/$1chown root /users/$1chgrp staff /users/$1chmod 755 /users/$1mkdir /users/$1/profilechown -R ROBOTS\\$1:ROBOTS\\Domain\ Users /users/$1chmod -R 700 /users/$1 - Now set the permissions to be executable by root and readable to everyone else
chmod 744 /root/userdirs - To create the home directory run the script, followed by their username. For instance, if I wanted to create a user directory for user "tew",
/root/userdirs tew
(written 2/4/2005)
