[Samba] Update from pdbsql (MySQL) to LDAP

M. Rodrigo Monteiro falecom at rodrigomonteiro.net
Tue Oct 6 07:05:59 MDT 2009

Hi All!

I have a Samba as PDC for my domain MY_NETWORK running normally.
What I want to do is to install another server with OpenLDAP as
backend, and migrate the users and the domain to it.
Can anyone point me how to do it?

Below is my configuration.

# smbd -V
Version 3.2.15-0.36.fc10

# uname -a
Linux svrmain2 #1 SMP Thu Oct 1
14:41:38 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

# cat /etc/fedora-release
Fedora release 10 (Cambridge)


workgroup = MY_NETWORK

server string = MY_NETWORK SERVER
netbios name = SERVER_MYNETWORK
security = user

smb ports = 139
domain logons = yes
domain master = yes
preferred master = Yes
admin users = root
guest account = nobody
logon path =
logon home =
logon drive = h:

os level = 200
log file = /var/log/samba/%m.log
log level = 2

max log size = 0
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
kernel oplocks = no
encrypt passwords = yes
passdb expand explicit = no

passwd program = /usr/bin/passwd %u
passwd chat = *Nova*UNIX*senha:* %n\n *Redigite*a*nova*UNIX*senha:*
%n\n *passwd:*all*authentication*tokens*updated*successfully.*
unix password sync = yes

dos charset = cp850
unix charset = UTF8
display charset = LOCALE

vfs object = recycle
      recycle:repository = .lixeira
      recycle:keeptree = yes
      recycle:versions = yes
      recycle:directory_mode = 0770
      recycle:noversions = *.doc|*.xls|*.ppt
      recycle:noversions = *.odt|*.ods|*.odp|*.doc|*.xls|*.ppt

veto files = copy.exe/host.exe
dns proxy = no
nt acl support = yes
wins support = yes

winbind uid = 10000-20000
winbind gid = 10000-20000
winbind enum users = yes
winbind enum groups = yes
template homedir = /dev/null
template shell = /dev/null
winbind use default domain  = yes

passdb backend = mysql:mysql
mysql:mysql host = localhost
mysql:mysql user = root
mysql:mysql password =
mysql:mysql database = samba

add user script = /usr/sbin/useradd -g users "%u"
delete user script = /usr/sbin/userdel -r "%u"
add user to group script = /usr/bin/gpasswd -a "%u" "%g"
delete user from group script = /usr/bin/gpasswd -d "%u" "%g"
add group script = /usr/sbin/groupadd "%g"
delete group script = /usr/sbin/groupdel "%g"
rename user script = /usr/sbin/usermod -l "%unew" "%uold"
set primary group script =  /usr/sbin/usermod -g "%g" "%u"
add machine script = /usr/sbin/adduser -d /dev/null -s /bin/false "%u"

# grep rodrigo /etc/passwd

# grep rodrigo /etc/shadow

	logon_time int(9) default NULL,
	logoff_time int(9) default NULL,
	kickoff_time int(9) default NULL,
	pass_last_set_time int(9) default NULL,
	pass_can_change_time int(9) default '0',
	pass_must_change_time int(9) default '2147483647',
	username varchar(255) default NULL,
	domain varchar(255) default NULL,
	nt_username varchar(255) default NULL,
	nt_fullname varchar(255) default NULL,
	home_dir varchar(255) default NULL,
	dir_drive varchar(4) default NULL,
	logon_script varchar(255) default NULL,
	profile_path varchar(255) default NULL,
	acct_desc varchar(255) default NULL,
	workstations varchar(255) default NULL,
	unknown_str varchar(255) default NULL,
	munged_dial varchar(255) default NULL,
	uid int(9) NOT NULL PRIMARY KEY auto_increment,
	gid int(9) default NULL,
	user_sid varchar(255) default NULL,
	group_sid varchar(255) default NULL,
	lm_pw varchar(255) default NULL,
	nt_pw varchar(255) default NULL,
	acct_ctrl int(9) default '528',
	logon_divs int(9) default '168',
	hours_len int(9) default '21',
	unknown_6 int(9) default "1260",
	bad_password_count int(9) default NULL,
	logon_count int(9) default '0',
	logon_hours varchar(42) default NULL,
	password_history text default NULL,
	KEY username(username)

INSERT INTO `user` (`logon_time`, `logoff_time`, `kickoff_time`,
`pass_last_set_time`, `pass_can_change_time`, `pass_must_change_time`,
`username`, `domain`, `nt_username`, `nt_fullname`, `home_dir`,
`dir_drive`, `logon_script`, `profile_path`, `acct_desc`,
`workstations`, `comment`, `munged_dial`, `uid`, `gid`, `user_sid`,
`group_sid`, `lm_pw`, `nt_pw`, `acct_ctrl`, `logon_divs`, `hours_len`,
`unknown_6`, `bad_password_count`, `logon_count`, `logon_hours`,
`password_history`) VALUES

M. Rodrigo Monteiro
falecom at rodrigomonteiro.net
"Free as in Freedom, not free as in free beer"
"As we are liberated from our own fear, our presence automatically
liberates others"
Linux User # 403730

More information about the samba mailing list