Samba NT Domain Controller

Currently, Samba can go beyond merely emulating Windows shares to actually acting as the Primary Domain Controller for your Windows network. Of course, Samba can also become a NT domain member. In this article we shall look at both these options.

The domain concept is much better than the traditional workgroup concept. One of the primary benefits is having a centralized password database on the Primary Domain Controller. Once authenticated, you can access any of the shares in the domain, without having to re-authenticate yourself.

If you're unfamiliar with Samba, then we've got a couple of good howto's that you can refer to. Look for links to them at the bottom of the article.

Samba as a NT Domain Member

Samba emulates a NT workstation when becoming part of the domain. So, the first thing you need to do is create a machine account for your Samba machine on the domain controller. In NT you would use the program Server Manager for Domains to create the account. Once the account is created, all you need to add are the following lines to your smb.conf file under the global section.

# Your Workgroup or Domain that you want
# to login to
workgroup = FREEOS

# Tell Samba to talk to domain controller
# for authentication
security = domain

# Specify the server to get authenticate 
# from. You can specify the 
# NetBIOS # names of the servers or simply 
# put in a "*" here to let 
# Samba find the server through broadcast 
password server = PS1 PS2

# Make sure Samba is using encrypted 
# passwords
encrypt passwords = yes

Now stop the Samba daemons

/etc/rc.d/init.d/smb stop

Give the following command to join the 
NT Domain

smbpasswd -j DOMAIN -r DOMAINPDC

DOMAIN here is the domain that you want to log on to. DOMAINPDC is the primary domain controller for that domain. You will then see a message saying, 揓oined domain DOMAIN?

Now start your SMB and NMB daemons.

/etc/rc.d/init.d/smb start

That was all about joining an NT domain. Setting up Samba as your Primary Domain Controller is not very difficult.

Samba as Primary Domain Controller

Add the following to the global section of your smb.conf file.

# The domain you want to be a PDC for
workgroup = SIMPLE

# Tell Samba to use domain logons
domain logons = yes

# User-level security. Users must 
# authenticate themselves with
# valid username and password
security = user

# Set to yes so that nmbd participates 
# in local master browser
# elections
local master = yes

# Set Os level value to make sure nmbd 
# wins local browse master 
# elections. 65 should beat everyone 
# according to the man page
os level = 65

# Give nmbd an advantage in local 
# master browser elections
preferred master = yes

# Set so that nmbd claims a unique 
# NetBIOS name identifying it as 
# a domain master
domain master = yes

# The following share is required to support
# domain logons. The directory may be 
# created anywhere on your system. Make 
# sure the share is non-writeable and also
# not a public share.
[netlogon]
comment = The domain logon service
path = /usr/local/samba/netlogon
public = no
writeable = no

The next thing to do is create the users on the Samba server that is to act as the domain controller. You can do this using the useradd command.

useradd ?g smbuser ?d /dev/null ?s /dev/null ntuser

As you can see, both shell and home directory for ntuser is set to /dev/null. If your Windows users are not required to access the Unix box, you should use the above to deny access to the machine. Passwords are also not required to be set because Samba keeps the password hash in a separate file specified in the configuration file.

# Path to Samba password file
# Make sure only root has read/write access
smb passwd file = /usr/local/samba/smbpasswd

After adding a user (you can also use vipw to add a user), you need to add the user to the samba password database.

搒mbpasswd 朼?will add all users in Unix passwd file to smbpasswd file. The usage and syntax is similar to the Unix passwd command. To change a users?password use 搒mbpasswd username?

That will be enough for Samba to start authenticating Windows 9X clients. For NT workstations, some more work is to be done. You have to create a machine account for each NT client that will logon. A machine account is simply a regular /etc/passwd entry, with a ??appended to the name of the NT machine.

useradd -g smbuser -杁 /dev/null -杝 /dev/null ntclient$

Now add it to the password database

smbpasswd 朼 杕 ntclient (the $ at the end is not required)

Samba can now accept logons from a NT client.

As you can see, configuring samba as a domain controller and domain member is a fairly easy job. The flip side is that since samba is the result of major amounts of hacking and reverse engineering, it doesn't have all the functionality of a proper domain controller. There is an alternative branch, Samba TNG that adds more functionality in this area.

(0)

相关推荐

  • samba共享目录权限问题

    首先当然是要安装samba了,呵呵: 代码: sudo apt-get install samba sudo apt-get install smbfs 下面我们来共享群组可读写文件夹,假设你要共享的文件夹为: /home/ray/share 首先创建这个文件夹 代码: mkdir /home/ray/share chmod 777 /home/ray/share 备份并编辑smb.conf允许网络用户访问 代码: sudo cp /etc/samba/smb.conf /etc/samba/s

  • 默认Samba版本在RedHat 9上的溢出获取root演示

    从近日对被黑服务器的安全分析来看,我找到该用户提升权限的工具.他是利用了Samba的安全漏洞提升为了ROOT. 这几天服务器因为要放到公网测试,此时又安装了Samba服务器.结果第二天就发现了服务器被黑 Samba是在Redhat Linux 9上默认的版本.使用了该黑客的强大的exploit工具提升为了root. 提升为root,只需要短短的3秒钟 自己汗一个 从服务器的tmp查找到一个x2k3的目录 [bob@learnin9 tmp]$ cd x2k3/ [bob@learnin9 x2k

  • 在ubuntu中部署samba服务器的方法

    Samba服务在Ubuntu服务器版本中默认并没有安装.今天公司上了一批新电脑,准备把它装成服务器,于是为了方便开发的使用,我在上面部署了一个samba,用来实现window和linux的联系: 具体步骤,我详细的查看了百度,高手云集,以下就是总结了网友的经验,现在记下来,以后有用就不用到处找了. 一. samba的安装: sudo apt-get install samba sudo apt-get install smbfs 二. 创建共享目录: mkdir /home/phinecos/s

  • Linux加入windows ad域步骤详解(winbindsamba方案)

    linux加入域中,一般都会想到加入LDAP中,这样管理起来方便,不过在linux下LDAP配置起来可不是很容易的,在企业办公环境中一般windows AD域占据霸主地位,配置方便嘛,针对生产环境的linux集群机器才会选择LDAP,不过有时候在办公环境中也混杂了linux机器,为了规范管理,也是需要把linux机器加入window是 AD中的. linux加入windows AD中方便操作的有两种方案(分为centos/ubuntu两种情况).都说了是方便操作,那必然是懒人的首选方法了. 1

  • PHP和Shell实现检查SAMBA与NFS Server是否存在

    通常会通过 /etc/fstab 来处理挂载的设置,然后再使用 mount -a 来重新确认挂载,最好在排程的程序用到挂载目录时也执行一次 mount -a,挂载目录在断线后是不会自动回复的,mount -a 的 Timeout 其实还蛮久的,尤其是 Server 不存在的时候,所以最好还是用对应的 client 先确认 server 是否存在. 而检查 NFS 的 client 可以用 showmount 来处理,在 Ubuntu 上的安装方式如下: 复制代码 代码如下: sudo aptit

  • RHE5服务器配置-搭建Samba服务器步骤(图)

    认识Samba   Samba的核心是两个守护进程,即smbd和nmbd.服务器启动到停止期间持续运行,smba监听139TCP端口:nmbd监听137和138UDP端口.smbd和nmbd使用的全部配置信息保存在smb.conf文件中,smb.conf向smbd和nmbd两个守护进程说明输出什么,共享输出给谁及如何输出以便共享.smbd进程的作用是处理到来的SMB数据包,为使用该数据包的资源与Linux协商:nmbd进程使其他主机(或工作站)能浏览Linux服务器. 一.安装配置Samba的R

  • Samba NT Domain Controller

    Currently, Samba can go beyond merely emulating Windows shares to actually acting as the Primary Domain Controller for your Windows network. Of course, Samba can also become a NT domain member. In this article we shall look at both these options. The

  • 不错的windows server 2003 工具资源命令集

    这是新年的第一篇日志,呵呵也算是精品吧.在网上闲逛时发现的. accwiz.exe > Accessibility Wizard for walking you through setting up your machine for your mobility needs. 辅助工具向导 acsetups.exe > ACS setup DCOM server executable actmovie.exe > Direct Show setup tool 直接显示安装工具 append

  • 使用xcacls.vbs(cacls.exe)修改NTFS权限说明(中文版)第1/2页

    概要 Microsoft 以 Microsoft Visual Basic 脚本 (Xcacls.vbs) 的形式提供了 Extended Change Access Control List(扩展更改访问控制列表)工具 (Xcacls.exe) 的更新版本.本文分步介绍如何使用 Xcacls.vbs 脚本修改和查看文件或文件夹的 NTFS 文件系统权限. 可以从命令行使用 Xcacls.vbs 设置所有可在 Microsoft Windows 资源管理器中访问的文件系统安全选项.Xcacls.

  • 设置高级NTFS权限的工具 XCACLS.vbs

    http://support.microsoft.com/kb/825751 Microsoft 以 Microsoft Visual Basic 脚本 (Xcacls.vbs) 的形式提供了 Extended Change Access Control List(扩展更改访问控制列表)工具 (Xcacls.exe) 的更新版本.本文分步介绍如何使用 Xcacls.vbs 脚本修改和查看文件或文件夹的 NTFS 文件系统权限. 可以从命令行使用 Xcacls.vbs 设置所有可在 Microso

  • 局域网中工作组和域的差别

    为什么要组建局域网呢?就是要实现资源的共享,既然资源要共享,资源就不会太少.如何管理这些在不同机器上的资源呢?域和工作组就是在这样的环境中产生的两种不同的网络资源管理模式.那么究竟什么是域,什么是工作组呢?它们的区别又是什么呢? "自由"的工作组 工作组(Work Group)就是将不同的电脑按功能分别列入不同的组中,以方便管理.比如在一个网络内,可能有成百上千台工作电脑,如果这些电脑不进行分组,都列在"网上邻居"内,可想而知会有多么乱(恐怕网络邻居也会显示&quo

  • 简单就是美,网络命令行的使用和范例

    1.最基本,最常用的,测试物理网络的 ping 192.168.0.8 -t ,参数-t是等待用户去中断测试 2.查看DNS.IP.Mac等 A.Win98:winipcfg B.Win2000以上:Ipconfig/all C.NSLOOKUP:如查看河北的DNS C:\>nslookup Default Server: ns.hesjptt.net.cn Address: 202.99.160.68 >server 202.99.41.2 则将DNS改为了41.2 > pop.pcp

  • 局域网中工作组和域之间的差别

    为什么要组建局域网呢?就是要实现资源的共享,既然资源要共享,资源就不会太少.如何管理这些在不同机器上的资源呢?域和工作组就是在这样的环境中产生的两种不同的网络资源管理模式.那么究竟什么是域,什么是工作组呢?它们的区别又是什么呢? "自由"的工作组 工作组(Work Group)就是将不同的电脑按功能分别列入不同的组中,以方便管理.比如在一个网络内,可能有成百上千台工作电脑,如果这些电脑不进行分组,都列在"网上邻居"内,可想而知会有多么乱(恐怕网络邻居也会显示&quo

  • 探索PowerShell(九) 条件控制、逻辑

    逻辑判断 先来简单介绍最基本的逻辑判断: • -eq 判断是否等于(equal) • -lt 判断时候小于(less than) • -gt 判断是否大于(greater than) • -ge 判断是否大于或等于(greater of equal) • -le 判断是否小于或等于(less or equal) • -ne 判断是否不等于(no equal) 在之前的几个小节中,如果你注意的话,应该可以发现PowerShell对于大小写并不敏感,可是在某些时候我们却需要区分它们,因此,还可以使用

  • 网络安全方面的专业词汇

    Access Control List(ACL) 访问控制列表  access token 访问令牌  account lockout 帐号封锁  account policies 记帐策略  accounts 帐号  adapter 适配器  adaptive speed leveling 自适应速率等级调整  Address Resolution Protocol(ARP) 地址解析协议  Administrator account 管理员帐号  ARPANET 阿帕网(internet的前

  • 利用VBS脚本自动创建计算机帐户的代码

    mcse注:其实这是 按照ADSI(Active Directory Services Interface:活动目录服务接口)写的程序.如果你安装了resource kit,这段代码可以用netcom这条命令进行工作,下面是netcom的一个例子: NETDOM /Domain:MYDOMAIN /user:adminuser /password:apassword MEMBER MYCOMPUTER /ADD 复制代码 代码如下: *********************** '* Star

随机推荐