Samba NT Domain Controller

所属分类: 操作系统 / unix linux 阅读数: 70
收藏 0 赞 0 分享
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. 
更多精彩内容其他人还在看

vm下centos7 mini版 NAT模式下配置静态IP的方法

这篇文章主要介绍了vm下centos7 mini版 NAT模式下配置静态IP 的方法,本文图文并茂给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下
收藏 0 赞 0 分享

window10系统安装Ubuntu18.04系统的图文教程详解

这篇文章主要介绍了window10系统安装Ubuntu18.04系统,本文图文并茂给大家介绍的非常详细,具有一定的参考借鉴价值 ,需要的朋友可以参考下
收藏 0 赞 0 分享

linux yum安装指定版本mysql的教程详解

这篇文章主要介绍了linux yum安装指定版本mysql的教程,本文给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下
收藏 0 赞 0 分享

ubuntu系统下Python虚拟环境的安装和使用教程

这篇文章主要介绍了ubuntu系统下Python虚拟环境的安装和使用教程,本文给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下
收藏 0 赞 0 分享

在 Ubuntu 上安装 pip的方法

这篇文章主要介绍了在 Ubuntu 上安装 pip的方法,非常不错,具有一定的参考借鉴价值,非常不错,具有一定的参考借鉴价值,需要的朋友可以参考下
收藏 0 赞 0 分享

最全的VI命令与快捷键大全集合建议收藏

vi编辑器是所有Unix及Linux系统下标准的编辑器,它的强大不逊色于任何最新的文本编辑器,这里为大家分享VI命令,需要的朋友可以参考下
收藏 0 赞 0 分享

详解Ubuntu18.04下配置Nginx+RTMP+HLS+HTTPFLV服务器实现点播/直播/录制功能

这篇文章主要介绍了Ubuntu18.04下配置Nginx+RTMP+HLS+HTTPFLV服务器实现点播/直播/录制功能,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
收藏 0 赞 0 分享

Centos7重启apache、nginx、mysql、php-fpm命令方法

这篇文章主要介绍了Centos7重启apache、nginx、mysql、php-fpm命令方法,需要的朋友可以参考下
收藏 0 赞 0 分享

linux 部署apache服务的步骤

这篇文章主要介绍了linux部署apache服务的步骤,部署apache服务的步骤本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
收藏 0 赞 0 分享

统计Linux 中文件和文件夹/目录的数量(示例代码)

这篇文章主要介绍了统计Linux 中文件和文件夹/目录的数量(示例代码),需要的朋友可以参考下
收藏 0 赞 0 分享
查看更多