Can linux join domain

Integrate Ubuntu 16.04 to AD as a Domain Member with Samba and Winbind – Part 8

This tutorial describes how to join an Ubuntu machine into a Samba4 Active Directory domain in order to authenticate AD accounts with local ACL for files and directories or to create and map volume shares for domain controller users (act a as file server).

Requirements:

Step 1: Initial Configurations to Join Ubuntu to Samba4 AD

1. Before starting to join an Ubuntu host into an Active Directory DC you need to assure that some services are configured properly on local machine.

An important aspect of your machine represents the hostname. Setup a proper machine name before joining the domain with the help of hostnamectl command or by manually editing /etc/hostname file.

# hostnamectl set-hostname your_machine_short_name # cat /etc/hostname # hostnamectl

Set System Hostname

2. On the next step, open and manually edit your machine network settings with the proper IP configurations. The most important settings here are the DNS IP addresses which points back to your domain controller.

Edit /etc/network/interfaces file and add dns-nameservers statement with your proper AD IP addresses and domain name as illustrated on the below screenshot.

Also, make sure that the same DNS IP addresses and the domain name are added to /etc/resolv.conf file.

Configure Network Settings for AD

On the above screenshot, 192.168.1.254 and 192.168.1.253 are the IP addresses of the Samba4 AD DC and Tecmint.lan represents the name of the AD domain which will be queried by all machines integrated into realm.

3. Restart the network services or reboot the machine in order to apply the new network configurations. Issue a ping command against your domain name in order to test if DNS resolution is working as expected.

The AD DC should replay with its FQDN. In case you have configured a DHCP server in your network to automatically assign IP settings for your LAN hosts, make sure you add AD DC IP addresses to the DHCP server DNS configurations.

# systemctl restart networking.service # ping -c2 your_domain_name

4. The last important configuration required is represented by time synchronization. Install ntpdate package, query and sync time with the AD DC by issuing the below commands.

$ sudo apt-get install ntpdate $ sudo ntpdate -q your_domain_name $ sudo ntpdate your_domain_name

Time Synchronization with AD

5. On the next step install the software required by Ubuntu machine to be fully integrated into the domain by running the below command.

$ sudo apt-get install samba krb5-config krb5-user winbind libpam-winbind libnss-winbind

Install Samba4 in Ubuntu Client

While the Kerberos packages are installing you should be asked to enter the name of your default realm. Use the name of your domain with uppercases and press Enter key to continue the installation.

Add AD Domain Name

6. After all packages finish installing, test Kerberos authentication against an AD administrative account and list the ticket by issuing the below commands.

# kinit ad_admin_user # klist

Check Kerberos Authentication with AD

Step 2: Join Ubuntu to Samba4 AD DC

7. The first step in integrating the Ubuntu machine into the Samba4 Active Directory domain is to edit Samba configuration file.

Читайте также:  Установка даллас лок альт линукс

Backup the default configuration file of Samba, provided by the package manager, in order to start with a clean configuration by running the following commands.

# mv /etc/samba/smb.conf /etc/samba/smb.conf.initial # nano /etc/samba/smb.conf

On the new Samba configuration file add the below lines:

[global] workgroup = TECMINT realm = TECMINT.LAN netbios name = ubuntu security = ADS dns forwarder = 192.168.1.1 idmap config * : backend = tdb idmap config *:range = 50000-1000000 template homedir = /home/%D/%U template shell = /bin/bash winbind use default domain = true winbind offline logon = false winbind nss info = rfc2307 winbind enum users = yes winbind enum groups = yes vfs objects = acl_xattr map acl inherit = Yes store dos attributes = Yes

Configure Samba for AD

Replace workgroup, realm, netbios name and dns forwarder variables with your own custom settings.

The winbind use default domain parameter causes winbind service to treat any unqualified AD usernames as users of the AD. You should omit this parameter if you have local system accounts names which overlap AD accounts.

8. Now you should restart all samba daemons and stop and remove unnecessary services and enable samba services system-wide by issuing the below commands.

$ sudo systemctl restart smbd nmbd winbind $ sudo systemctl stop samba-ad-dc $ sudo systemctl enable smbd nmbd winbind

9. Join Ubuntu machine to Samba4 AD DC by issuing the following command. Use the name of an AD DC account with administrator privileges in order for the binding to realm to work as expected.

$ sudo net ads join -U ad_admin_user

Join Ubuntu to Samba4 AD DC

10. From a Windows machine with RSAT tools installed you can open AD UC and navigate to Computers container. Here, your Ubuntu joined machine should be listed.

Confirm Ubuntu Client in Windows AD DC

Step 3: Configure AD Accounts Authentication

11. In order to perform authentication for AD accounts on the local machine, you need to modify some services and files on the local machine.

First, open and edit The Name Service Switch (NSS) configuration file.

$ sudo nano /etc/nsswitch.conf

Next append winbind value for passwd and group lines as illustrated on the below excerpt.

passwd: compat winbind group: compat winbind

Configure AD Accounts Authentication

12. In order to test if the Ubuntu machine was successfully integrated to realm run wbinfo command to list domain accounts and groups.

List AD Domain Accounts and Groups

13. Also, check Winbind nsswitch module by issuing the getent command and pipe the results through a filter such as grep to narrow the output only for specific domain users or groups.

$ sudo getent passwd| grep your_domain_user $ sudo getent group|grep 'domain admins'

Check AD Domain Users and Groups

14. In order to authenticate on Ubuntu machine with domain accounts you need to run pam-auth-update command with root privileges and add all the entries required for winbind service and to automatically create home directories for each domain account at the first login.

Читайте также:  Установить все шрифты linux

Check all entries by pressing [space] key and hit ok to apply configuration.

Authenticate Ubuntu with Domain Accounts

15. On Debian systems you need to manually edit /etc/pam.d/common-account file and the following line in order to automatically create homes for authenticated domain users.

session required pam_mkhomedir.so skel=/etc/skel/ umask=0022

Authenticate Debian with Domain Accounts

16. In order for Active Directory users to be able to change password from command line in Linux open /etc/pam.d/common-password file and remove the use_authtok statement from password line to finally look as on the below excerpt.

password [success=1 default=ignore] pam_winbind.so try_first_pass

Users Allowed to Change Password

17. To authenticate on Ubuntu host with a Samba4 AD account use the domain username parameter after su – command. Run id command to get extra info about the AD account.

Find AD User Information

Use pwd command to see your domain user current directory and passwd command if you want to change password.

18. To use a domain account with root privileges on your Ubuntu machine, you need to add the AD username to the sudo system group by issuing the below command:

$ sudo usermod -aG sudo your_domain_user

Login to Ubuntu with the domain account and update your system by running apt-get update command to check if the domain user has root privileges.

Add Sudo User Root Group

19. To add root privileges for a domain group, open end edit /etc/sudoers file using visudo command and add the following line as illustrated on the below screenshot.

%YOUR_DOMAIN\\your_domain\ group ALL=(ALL:ALL) ALL

Add Root Privileges to Domain Group

Use backslashes to escape spaces contained into your domain group name or to escape the first backslash. In the above example the domain group for TECMINT realm is named “domain admins”.

The preceding percent sign (%) symbol indicates that we are referring to a group, not a username.

20. In case you are running the graphical version of Ubuntu and you want to login on the system with a domain user, you need to modify LightDM display manager by editing /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf file, add the following lines and reboot the machine to reflect changes.

greeter-show-manual-login=true greeter-hide-users=true

It should now be able to perform logins on Ubuntu Desktop with a domain account using either your_domain_username or [email protected]_domain.tld or your_domain\your_domain_username format.

Источник

How can I have a Linux machine join a Windows Domain?

Sorry if I am misusing terms here; I actually don’t know much about Active Directory and the related technologies. Basically I have a Linux computer and I’d like it (or my user on that computer) to be associated with my user on the Domain, so that I can browse the network and all that stuff windows has. Is this feasible? What do I need to look into to do something like this?

7 Answers 7

There are three main options:

  • Kerberos plus LDAP — This is a lower-level option where you set up Linux to use Active Directory’s underlying protocols yourself. Described in this answer.
  • Samba — Samba is the de facto standard for joining a Linux machine to a Windows domain.
  • Microsoft Windows Services for Unix includes options for serving usernames to Linux / UNIX via NIS and for synchronizing passwords to Linux / UNIX machines. You’d use this if you wanted to do everything possible from Windows or if you had an existing Linux / UNIX infrastructure you wanted to tie to Windows; for most environments, though, one of the other solutions would be better.
Читайте также:  Linux ftp file system

There are a few other options available too: Likewise (apparently no longer available), Centrify, SSSD. There’s further discussion in this question.

+1 for Likewise. Likewise Open has saved me hundreds of hours in user administration. I specifically built an AD infrastructure for my Linux boxes. Way, way way way way better.

Likewise appears to be dead; at least your link goes to some unrelated business and searching doesn’t turn up much.

Likewise was purchased by Isilon (now DellEMC) for inclusion in their NAS. I guess they did away with the standalone product.

Two ways that I know of. From the linux host you can try this:

root# net ads join -UAdministrator%password

Or you can just create the computer object in active directory.

Like everyone else said, you’ll need to add the samba packages to get that to happen.

I’d suggest looking at an excellent public domain package called Samba. It might very well be part of the Linux distribution that you have installed.

In order to get all the benefits and security of AD, you’ll need a solution involving Kerberos (for authentication) and LDAP (for authorization). There’s an excellent tutorial here that I’ve used in the past and it works amazingly well. It’s more complex to implement than just using samba/winbindd, but you’ll get the benefit of being able to use the UNIX attributes in AD to manage your linux users, groups, uids, gids, etc.

I believe that Samba/Winbind can use AD’s UNIX attributes as well, using the idmap_ad backend (samba.org/samba/docs/man/manpages-3/idmap_ad.8.html) and the «winbind nss info» smb.conf setting (samba.org/samba/docs/man/manpages-3/smb.conf.5.html#id2564796) setting.

Heh, news to me 🙂 That’s a nice feature to have. I guess I still prefer the security that Kerberos brings, but for more simple setups, this will probably be just fine.

I don’t find that tutorial excellent at all. For example, it says «Make sure that the appropriate Kerberos libraries, OpenLDAP, pam_krb5, and nss_ldap are installed. If they are not installed, install them.», without any more details.

@FrankH. You’ll notice that this answer is 7 years old. If you have a better tutorial that you can link to, by all means edit my answer accordingly. However, if you are a linux sysadmin, being able to install packages without step-by-step instructions are among the first things one should learn.

@FrankH. You are a professional. You cannot reasonably expect to do your job by following perfectly comprehensive, step-by-step instructions for every single task that you need to do. Some level of initiative is required to go out and actually learn the operating systems you’re using. If you’re unable or unwilling to do that, then hire someone to help you out. There’s no shame in doing that.

Источник

Оцените статью
Adblock
detector