I installed samba and made it a simple domain controller, and I intend to set it to make the authentication over OpenLDAP. The problem is I can NOT run both slapd and samba processes at the same time.
If I ran Samba at first (samba will run and work normally), and then next the slapd, the slapd will not run, it tells me that the port is being used, and I am not able to use it.
slapd starting process outout:
root@linuxserver:/home/mohammed# /etc/init.d/slapd status ● slapd.service - LSB: OpenLDAP standalone server (Lightweight Directory Access Protocol) Loaded: loaded (/etc/init.d/slapd) Active: failed (Result: exit-code) since Wed 2016-02-17 11:31:36 CET; 41s ago Docs: man:systemd-sysv-generator(8) Process: 10297 ExecStop=/etc/init.d/slapd stop (code=exited, status=0/SUCCESS)
Process: 10697 ExecStart=/etc/init.d/slapd start (code=exited, status=1/FAILURE)Feb 17 11:31:36 linuxserver.example.local slapd[10701]: @(#) $OpenLDAP: slapd (Ubuntu) (Sep 15 2015 21:34:22) $ buildd@lgw01-27:/build/openldap-cOgeXt/openldap-2.4.41+dfsg/debian/build/servers/slapd Feb 17 11:31:36 linuxserver.example.local slapd[10701]: daemon: bind(9) failed errno=98 (Address already in use) Feb 17 11:31:36 linuxserver.example.local slapd[10701]: daemon: bind(9) failed errno=98 (Address already in use) Feb 17 11:31:36 linuxserver.example.local slapd[10701]: slapd stopped. Feb 17 11:31:36 linuxserver.example.local slapd[10701]: connections_destroy: nothing to destroy. Feb 17 11:31:36 linuxserver.example.local systemd[1]: slapd.service: Control process exited, code=exited status=1 Feb 17 11:31:36 linuxserver.example.local systemd[1]: Failed to start LSB: OpenLDAP standalone server (Lightweight Directory Access Protocol). Feb 17 11:31:36 linuxserver.example.local systemd[1]: slapd.service: Unit entered failed state. Feb 17 11:31:36 linuxserver.example.local systemd[1]: slapd.service: Failed with result 'exit-code'. Feb 17 11:31:36 linuxserver.example.local slapd[10697]: ...fail!
and if I did the opposite, so if I ran slapd at first (it will run correctly), and then next samba, samba will not work because it tells that there is somthing going wrong with the port, and I cannot use it.
samba starting process outout:
root@linuxserver:/home/mohammed# /etc/init.d/samba status ● samba-ad-dc.service - LSB: start Samba daemons for the AD DC
Loaded: loaded (/etc/init.d/samba-ad-dc) Active: active (running) since Wed 2016-02-17 11:38:03 CET; 3s ago Docs: man:systemd-sysv-generator(8) Process: 10774 ExecStop=/etc/init.d/samba-ad-dc stop (code=exited, status=0/SUCCESS) Process: 11026 ExecStart=/etc/init.d/samba-ad-dc start (code=exited, status=0/SUCCESS) CGroup: /system.slice/samba-ad-dc.service ├─11055 /usr/sbin/samba -D ├─11058 /usr/sbin/smbd -D --option=server role check:inhibit=yes --foreground └─11071 /usr/sbin/smbd -D --option=server role check:inhibit=yes --foregroundFeb 17 11:38:05 linuxserver.example.local samba[11060]: [2016/02/17 11:38:05.303292, 0] ../source4/smbd/service_stream.c:346(stream_setup_socket) Feb 17 11:38:05 linuxserver.example.local samba[11060]: Failed to listen on ::1:389 - NT_STATUS_ADDRESS_ALREADY_ASSOCIATED Feb 17 11:38:05 linuxserver.example.local samba[11060]: [2016/02/17 11:38:05.303771, 0] ../source4/ldap_server/ldap_server.c:821(add_socket) Feb 17 11:38:05 linuxserver.example.local samba[11060]: ldapsrv failed to bind to ::1:389 - NT_STATUS_ADDRESS_ALREADY_ASSOCIATED Feb 17 11:38:05 linuxserver.example.local samba[11060]: [2016/02/17 11:38:05.304082, 0] ../source4/smbd/service_task.c:35(task_server_terminate) Feb 17 11:38:05 linuxserver.example.local samba[11060]:
task_server_terminate: [Failed to startup ldap server task] Feb 17 11:38:05 linuxserver.example.local samba[11037]: STATUS=daemon 'samba' finished starting up and ready to serve connectionssamba_terminate: Failed t...rver task Feb 17 11:38:06 linuxserver.example.local smbd[11058]: [2016/02/17 11:38:06.082490, 0] ../lib/util/become_daemon.c:136(daemon_ready) Feb 17 11:38:06 linuxserver.example.local smbd[11072]: STATUS=daemon 'smbd' finished starting up and ready to serve connectionsUnable to connect to CUPS s...escriptor Feb 17 11:38:06 linuxserver.example.local smbd[11071]:
STATUS=daemon 'smbd' finished starting up and ready to serve connectionsfailed to retrieve printer ...UCCESSFUL Hint: Some lines were ellipsized, use -l to show in full.
And here is my smb.conf:
[global]
workgroup = EXAMPLE
realm = EXAMPLE.LOCAL
netbios name = LINUXSERVER
server role = active directory domain controller
dns forwarder = 8.8.8.8
idmap_ldb:use rfc2307 = yes
[netlogon]
path = /var/lib/samba/sysvol/example.local/scripts
read only = No
[sysvol]
path = /var/lib/samba/sysvol
read only = No
Could anybody help me to solve that please? Thanks in advance.
You've got the answer right in your question (it's even in bold)
Samba4 is an LDAP server, so of course it and OpenLDAP want to use the same port.
If you intended to have Samba authenticate against OpenLDAP, you can't configure it as a Domain Controller.
Although there are lots of tutorials around the web, the best place to get setup/installation information is the Samba wiki. If you set up a Samba Active Directory Domain Controller, other applications can authenticate against it with LDAP - a Samba DC is also an LDAP server.
As your logs say both services want to bind to port 389.
Samba 4, as a DC, includes and runs builtin LDAP server.
If you want to run both samba 4 DC and slapd server on the same host, you need to put them on different ip addresses. Changing ports is not an option because it breaks all the clients.