[Samba] id mapping
nick.e.couchman at gmail.com
Mon Sep 20 02:02:42 UTC 2021
On Sun, Sep 19, 2021 at 5:27 PM Rowland Penny via samba <
samba at lists.samba.org> wrote:
> On Sun, 2021-09-19 at 16:45 -0400, Nick Couchman wrote:
> > This may be a side note/topic, or some nuance, but I've seen this
> > stated multiple times on the list in absolute terms like this, and it
> > isn't strictly true, and very much depends on what you mean by "use
> > sssd with Samba." Do the two work together and talk to each other?
> > No. But can they be used side-by-side on the same system? Yes. I run
> > them both on the same system in my environment in a couple of places,
> > and it works perfectly fine. Do I recommend it? Absolutely not. I
> > think in the vast majority of places - 7x9s - it makes more sense to
> > just run winbind with Samba, and adding sssd provides nothing but
> > more headaches - another configuration to maintain, another set of
> > problems to debug, etc. But I've run into situations where I needed
> > sssd on the same system as Samba, and it can be done.
> You used to be able to use sssd with Samba, but from Samba 4.8.0 , the
> smbd binary must go via winbind to get to AD. This means, because sssd
> has its own version of the winbind libs, you cannot use sssd anymore.
> It may seem to work, but it will not work correctly and it isn't
> supported any longer.
Yes, I understand that Samba now requires winbind to function correctly
when interacting with Active Directory. I'm not arguing that point. I'm
just saying you can run both sssd and winbind side-by-side - at least, in
the distributions of Linux that I use there is no conflict and installing,
running, and configuring them concurrently. And, you can still choose to
use sssd for NSS and not use winbind for nss. Or you can use _both_ for
nss. There are endless possibilities (okay, maybe 4 possible permutations,
Again, I'm not saying I recommend it in most cases, but you can do it - it
does work, it is doable. There may even be real-world scenarios where it is
_required_ or _desirable_.
> > > Actually, it's definitely possible - I can think of at least two ways
> > this can be accomplished:
> > * Use sssd for NSS info instead of Winbind. Again, I'm not saying you
> > _should_, I'm saying you can, and sssd seems to be deterministic in
> > its ID mapping algorithm (similar to Winbind's idmap_autorid
> > backend).
> I think you missed that sssd is no longer supported with a Samba
I might be splitting hairs, but this statement isn't true. It _is_ true
that Samba (smbd) now requires winbindd to function correctly, and that
smbd won't talk to AD through sssd. It is not true that you cannot run sssd
concurrently with smbd+winbind. Should you? Probably not. Is it impossible?
No. How do I know? I have a server running in that configuration today, and
it works wonderfully.
> > * Use sssd's LDAP backend, and have the uid, gid, and shell
> > attributes present for users in your AD schema. Yes, this adds
> > further management and complication that may be undesirable, but it
> > is doable, and is the most deterministic method :-).
> You may be able to do this, but it is totally unsupported and you may
> as well use nslcd (which isn't supported as well).
Unsupported, as in I'll be ridiculed on this mailing list for running it
this way? Good to know.
> > Again, I know sssd comes with its own challenges, but I see all these
> > absolute statements of "you cannot do this" and "that is impossible"
> > when my real-world experience says it is possible. Whatever I'm doing
> > wrong is working in my environment.
> You are late to the party, you appear to be trying to make all the same
> mistakes that Debian based distro users made years ago. Forget sssd, it
> is no longer supported by Samba (not that it was ever really supported)
> and isn't needed.
Your opinion is noted.
> That will allow you ONE local Unix user and 1998 AD Unix users
> I wouldn't recommended it.
> > Why one local UNIX user? This doesn't make any sense.
> Exactly. Your DOMAIN range starts at '1001' and the Unix range starts
> at '1000', you do the maths, I come up with '1'
> Linux reserves the first 999 ID's for system users & groups, normal
> local Unix users & groups start at '1000' (do not confuse these with
> users in AD), so your Domain range needs to be above this. This is all
> explained in the wikipage I pointed you to.
This is the _default_ setting, but not the _only_ setting. I can very
easily add local users with the "useradd" command that are well above the
1000-1999 range. I can also change the default settings of a Linux
distribution to use a different range of user IDs, say 6000 - 6999. It's
pretty easy. So, if I wanted to, I could have winbind allocate IDs 1001 -
1999, and I would still have 2000 - 65535 (actually, much higher these
days, but that's the old-world UNIX maximum) to allocate in /etc/passwd and
/etc/group. The math adds up to far more than 1. Even the "reservation" of
IDs below 1000 for system users is encouraged as a best-practice, and a
sort of recognized defacto standard, but there's nothing special about
those IDs (aside from, maybe, 0).
> > tdb is the default backend that the Samba winbind config recommends
> > or defaults to, but it isn't the only one. You can look at
> > winbind's rid or autorid backends if you prefer something more
> > deterministic and less random (tdb isn't really random, just first-
> > come, first-served on a per-system basis).
> The 'tdb' backend is the recommended backend for the default '*' and
> this domain is meant for the 'Well Known SIDs' and anything outside the
> 'DOMAIN' domain (not including local Unix users).
> You should only require a few local Unix users (users in /etc/passwd),
> because all AD users can be Unix users.
My point is that tdb will end up with AD users that have different IDs on
different Linux systems. In many scenarios, particularly ones where you
have mostly Windows environments, where you don't care about what the local
ID actually is, this doesn't matter at all. There are some places where it
does matter - for example, when you have shared/clustered
filesystems (NFSv3, GFS(2), or NFSv4 without ID mapping), or you're
replicating things at a below-filesystem level (e.g. zfs send/receive,
drbd, etc.). In those cases it can be extremely helpful when UID and GID
numbers match up across systems, which means that they need to be generated
> Why? You've stated this multiple times, and you haven't really
> > provided any clear reasoning for the original user as to why you
> > think joining to the domain is the best option. Maybe it is, but
> > could you help him understand?
> There is a lot of baggage that gets dragged along with upgrading an
> NT4-style domain to an AD domain, amongst which is the old idea of
> using low ID's. This was only required when you had to have Samba users
> that were also Unix users in /etc/passwd, this is no longer required
> and should never be set up this way, just store everything in Samba AD.
> Of course, this is just my personal opinion, setting up a new AD domain
> gives you a fresh start, but you must use it to its best advantage,
> which to me means joining all machines to the domain.
Thank you. Sorry to have hi-jacked the thread. Feel free to ignore me and
More information about the samba