6

I'm adding some Fedora 20 workstations to our Windows 2003 domain. I've successfully joined the domain with the boxes, and can login with domain accounts.

Now I'm trying to allow the default AD group Enterprise Admins to use SUDO, however whatever I do, it seems that the group cannot be found (or at least it tells me my user account is not in the sudoers file)

Structure of the OU (default really):

  • mydomain.local
    • Builtin
    • Computers
    • DCOM-Users
    • DOmain Controllers
    • ForeignSecurityPrincipals
    • CompanyName
      • Management
      • Accounting
      • Admins
      • SysAccounts
      • CustomerService
      • Warehouse
    • Users

I used realmd and sssd to join the domain, and am trying to allow sudo to groups located under the Users OU, but would also like to add some from the CompanyName --> Admins OU/Sub-group as well.

I'm currently trying this with no luck (in /etc/sudoers)

%MYDOMAIN\\Enterprise^Admins ALL=(ALL) ALL

I've also tried variations as well, such as:

%MYDOMAIN\\Users\Enterprise^Admins ALL=(ALL) ALL
%Enterprise^Admins@mydomain.local ALL=(ALL) ALL

etc... nothing seems to be working. Even after reboots, and/or systemctrl restart sssd.

If i explicitly add my domain account to the /etc/sudoers file, it works no problem.

myuser@mydomain.local ALL=(ALL) ALL

There are a few resources that seem to indicate it should be possible to add AD groups to sudoers, however so far none of them have worked for me:

http://funwithlinux.net/2013/09/join-fedora-19-to-active-directory-domain-realmd/

https://serverfault.com/questions/387950/how-to-map-ad-domain-admins-group-to-ubuntu-admins

https://help.ubuntu.com/community/LikewiseOpen

6

Several months after you asked but the correct answer is that you remove all domain information from the group. All the information is set and extracted by SSSD automatically.

The only flaw I see in some of your examples is that you escaped the space with a ^.

An AD group of Enterprise Admins would have a sudoers line that starts with

%Enterprise\ Admins

For example, if your domain is example.com, then the sudoers line looks like

%Enterprise\ Admins@example.com ALL=(ALL) ALL

You can verify this by looking calling getent on the group.

getent group Enterprise\ Admins

2

winbind and sssd import the AD groups in an equivalent manner to NIS netgroups. So your group definitions in the /etc/sudoers file need to start with + and not %. Furthermore, names containing spaces should either be double-quoted, or each space specified as \x20.

%sudo              ALL = (ALL) ALL
+"domain users"    ALL = (ALL) ALL
+domain\x20admins  ALL = (ALL) NOPASSWD: ALL
  • 2
    I can verify that % also works. – Georgyo Jun 24 '15 at 23:10
  • @Georgyo thank you for that interesting update. When I started off with AD integration there was most definitely a difference between % and +. Perhaps they have merged over time and versions. I'll see if I can get time to revisit this on our newer systems here. – roaima Jun 24 '15 at 23:31
  • On Fedora 25 with its defaullt AD client setup I had to also specify the domain name, e.g: %domain\ admins@mydomain.com – Oskar Berggren Mar 4 '17 at 20:29
0

If you manage sudo with visudo, whether it is via PAM or just local sudoers file, then you use %GroupName.

If you use sudo-ldap then you have to configure your AD groups to be seen as netgroups and use +NetGroupName. I do this by enabling NFS role and create netgroups that go with my regular AD groups:

New-NfsNetgroup -NetGroupName MyNetGroup -AddMember MyMember

*note MyMember is not fqdn, just hostname

I also use sssd instead of PAM, so you have to flush cache with sss_cache -E to get new netgroup names.

Verify with:

getent netgroup MyNetGroup

Should see:

MyNetGroup    (MyMember,-,-)

I AM NOT enabling NFS shares on the ADDC, intalling NFS role allows creation on Netgroup namespaces.

-3

I don't think that sudo recognizes AD windows groups.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.