I've got a Debian/Jessie Samba 4.2.14 running as an AD member. ADC is a Windows2008R2 server. Join worked without problem.
# net ads testjoin
Join is OK
wbinfo -u
and wbinfo -g
work perfectly and provides a list of users and groups from the AD as expected. wbinfo -i <user>
works too:
# wbinfo -i TESTAD\\testuser
TESTAD\testuser:*:4294967295:4294967295:testuser:/home/TESTAD/testuser:/bin/false
Edit: something's wrong here, because wbinfo -i
maps all users and groups to the id 4294967295 which is, as @TheSkunk remarked, 2^32 -1.
Edit 2: wbinfo --sid-to-uid TESTAD\\testuser
fails. Surely I must set up explicitely some idmap
parameters (the defaults apparently don't work at all) but how?
Edit 3: I've added these 2 lines to smb.conf:
idmap config * : backend = tdb
idmap config * : range = 10000-30000
And now ẁbinfo -i TESTDOMAIN\testuserreports a valid id, and a different one for each and every user. However I still have the same problems (all users mapping to nobody,
idand
getent` not knowing of AD users, etc).
However getent passwd TESTAD\\testuser
fails:
# getent passwd TESTAD\\testuser
# echo $?
2
I can connect to the server with any AD account using smbclient
:
# smbclient //srv1/data -U TESTAD\\testuser
Enter TESTAD\testuser's password:
Domain=[TESTAD] OS=[Windows 6.1] Server=[Samba 4.2.14-Debian]
smb: \> ls
. D 0 Fri Feb 17 16:23:04 2017
.. D 0 Wed Feb 1 16:47:02 2017
test.txt N 5 Fri Feb 17 14:38:21 2017
popo D 0 Fri Feb 17 16:23:04 2017
117125466112 blocks of size 1024. 117052392484 blocks available
smb: \>
However the connection is mapped to nobody/nogroup
, and created files are owned by nobody
too.
Windows machines fail to connect using any AD account. However if I create a local account with smbpasswd -a <user>
, they can connect using it. However, their connection parameters, files, etc. are all mapped to nobody
though the account exists locally too.
Here's the current smb.conf
(as close to default as possible):
[global]
workgroup = TESTAD
realm = TESTAD.lan
server role = member server
security = ADS
map to guest = Bad User
obey pam restrictions = Yes
pam password change = Yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
unix password sync = Yes
syslog = 0
log file = /var/log/samba/log.%m
max log size = 1000
dns proxy = No
usershare allow guests = Yes
panic action = /usr/share/samba/panic-action %d
idmap config * : backend = tdb
inherit permissions = Yes
inherit acls = Yes
[DATA]
path = /mnt/raid/
read only = No
guest ok = Yes
here is /etc/nsswitch.conf
(I've tried adding and removing 'winbindd from shadow, no change at all):
# cat /etc/nsswitch.conf
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.
passwd: compat winbind
group: compat winbind
shadow: compat winbind
gshadow: files
hosts: files mdns4_minimal [NOTFOUND=return] dns wins
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
I don't understand why authentication never seems to go through winbind. I'm getting desperate, any ideas?
I've found the core problem: a missing package. Unfortunately it's not easy to get right: here is the final, working configuration (thanks to Rowland Penny from samba.org):
get sure you installed all the necessary packages (the missing one was libnss-winbind):
stop the services
set up a proper smb.conf (particularly the idmap parameters):
In that configuration, there is a required additional /etc/samba/user.map file containing the following line:
Don't forget to properly fill in /etc/krb5.conf:
Be careful, krb5.conf must be owned by root and readable by everyone (644 rights).
Edit /etc/nsswitch.conf and add winbind to the passwd and group lines:
Now join the domain:
Finally start the services:
getent passwd
should work with AD users now:CAVEAT As I had previously joined the AD without having installed the necessary libraries, I had to reboot the system to get the system after this setup to properly authenticate users!
4294967295 means 2^32 - this is an overflow of counter for GID or UID produced by the winbind deamon to translate xids from AD. That has nothing todo with guest mapping... If you use idmap config YOUR_DOMAIN : backend = ad , the ad means, that the information is not only stored localy, more else it is replicated during runtime to all clients and also stored on them (but where this is, thats currently my task for finding out). ad means, if a client gets lost, you've stored all uid/gid mapping information on the other ones. If you restore your client, all mapping will be the same again. The problem is, if you have this overflow once, you can't get rid of it easyli, because all clients ar replicating it (running windbind) and, perhaps (I'm currently trying to find it out) also the DC.
Here the part I'm using for that (works fine, but I have an other issue on idmaps via ad):
Having landed here myself, while looking for some good instructions, thought I should add an update to this post...
Going forward, we are aiming to use
sssd
instead ofwinbind
for Active Directory integration on Linux. Althoughsssd
doesn't offer all the features ofwinbind
, it uses Kerberos authentication instead of NT Lan Manager (NTLM) authentication. Ref: Red Hat Windows Integration Guide, Chapter 4.2We are trying to reduce the usage of NTLM authentication in favour of Kerberos, as the latter is considered a more secure protocol.
With that said, we've configured our SAMBA file share as follows:-
realmd
,samba
,sssd
and all dependencies. Maybe more?Join realm:
realm join <domain name>
This command will use domain credentials to join the machine to the domain. This will then automatically configure
nsswitch.conf
,/etc/sssd/sssd.conf
and/etc/krb5.conf
, and also obtain a machine keytab, in/etc/krb5.keytab
.Make sure the file system is mounted with the
acl
option in/etc/fstab
, e.g.UUID=foo-bar-baz /mnt/share ext4 defaults,acl 0 0
Configure samba correctly. There are so many options, that this is a bit of a dark art. YMMV, but what works for me is as follows. Anything withing
<
and>
needs to be configured for your own network.If somehow you locked yourself out of the share (as I did myself), Windows permissions can be viewed and changed using the following Linux commands:-
I had the error "client_input_channel_req: channel 0 rtype exit-status reply 0" on a new server02, on server01 no. The solution in my case was to add two lines that by mistake I did not add to /etc/samba/smb.conf:
template shell = /bin/bash
template home dir = /home/%D/%u
Now the domain users are logged in server02.
Best Regards.