You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -4,7 +4,7 @@ description: Learn how to enable identity-based Kerberos authentication for Linu
4
4
author: khdownie
5
5
ms.service: storage
6
6
ms.topic: how-to
7
-
ms.date: 03/30/2023
7
+
ms.date: 04/13/2023
8
8
ms.author: kendownie
9
9
ms.subservice: files
10
10
---
@@ -43,20 +43,24 @@ Before you enable AD authentication over SMB for Azure file shares, make sure yo
43
43
Installing the samba package isn't strictly necessary, but it gives you some useful tools and brings in other packages automatically, such as `samba-common` and `smbclient`. Run the following commands to install it. If you're asked for any input values during installation, leave them blank.
The `wbinfo` tool is part of the samba suite. It can be useful for authentication and debugging purposes, such as checking if the domain controller is reachable, checking what domain a machine is joined to, and finding information about users.
51
51
52
-
Make sure that the Linux host keeps the time synchronized with the domain server. Refer to the documentation for your Linux distribution. For some distros, you can do this [using systemd-timesyncd](https://www.freedesktop.org/software/systemd/man/timesyncd.conf.html). Here's a sample configuration.
52
+
Make sure that the Linux host keeps the time synchronized with the domain server. Refer to the documentation for your Linux distribution. For some distros, you can do this [using systemd-timesyncd](https://www.freedesktop.org/software/systemd/man/timesyncd.conf.html). Edit `/etc/systemd/timesyncd.conf` with your favorite text editor to include the following:
@@ -68,8 +72,10 @@ Follow these steps to enable AD Kerberos authentication. [This Samba documentati
68
72
1. Make sure that the DNS servers supplied contain the domain server IP addresses.
69
73
70
74
```bash
71
-
localadmin@contosovm:~$ systemd-resolve --status
75
+
systemd-resolve --status
76
+
```
72
77
78
+
```output
73
79
Global
74
80
DNSSEC NTA: 10.in-addr.arpa
75
81
16.172.in-addr.arpa
@@ -116,7 +122,10 @@ MulticastDNS setting: no
116
122
3. If it didn't work, make sure that the domain server IP addresses are pinging.
117
123
118
124
```bash
119
-
localadmin@contosovm:~$ ping 10.0.2.5
125
+
ping 10.0.2.5
126
+
```
127
+
128
+
```output
120
129
PING 10.0.2.5 (10.0.2.5) 56(84) bytes of data.
121
130
64 bytes from 10.0.2.5: icmp_seq=1 ttl=128 time=0.898 ms
122
131
64 bytes from 10.0.2.5: icmp_seq=2 ttl=128 time=0.946 ms
@@ -130,10 +139,9 @@ rtt min/avg/max/mdev = 0.898/0.922/0.946/0.024 ms
130
139
131
140
4. If the ping doesn't work, go back to [prerequisites](#prerequisites), and make sure that your VM is on a VNET that has access to the Azure AD tenant.
132
141
133
-
5. If the IP addresses are pinging but the DNS servers aren't automatically discovered, you can add the DNS servers manually.
142
+
5. If the IP addresses are pinging but the DNS servers aren't automatically discovered, you can add the DNS servers manually. Edit `/etc/netplan/50-cloud-init.yaml` with your favorite text editor.
6. Winbind assumes that the DHCP server keeps the domain DNS records up-to-date. However, this isn't true for Azure DHCP. In order to set up the client to make DDNS updates, use [this guide](../../virtual-network/virtual-networks-name-resolution-ddns.md#linux-clients) to create a network script. Here's a sample script.
6. Winbind assumes that the DHCP server keeps the domain DNS records up-to-date. However, this isn't true for Azure DHCP. In order to set up the client to make DDNS updates, use [this guide](../../virtual-network/virtual-networks-name-resolution-ddns.md#linux-clients) to create a network script. Here's a sample script that lives at `/etc/dhcp/dhclient-exit-hooks.d/ddns-update`.
172
+
173
+
```plaintext
162
174
#!/bin/sh
163
175
164
176
# only execute on the primary nic
@@ -186,7 +198,10 @@ fi
186
198
1. Make sure that you're able to ping the domain server by the domain name.
### Set up hostname and fully qualified domain name (FQDN)
219
237
220
-
1.Update the `/etc/hosts` file with the final FQDN (after joining the domain) and the alias for the host. The IP address doesn't matter for now because this line will mainly be used to translate short hostname to FQDN. For more details, see [Setting up Samba as a Domain Member](https://wiki.samba.org/index.php/Setting_up_Samba_as_a_Domain_Member).
238
+
1.Using your text editor, update the `/etc/hosts` file with the final FQDN (after joining the domain) and the alias for the host. The IP address doesn't matter for now because this line will mainly be used to translate short hostname to FQDN. For more details, see [Setting up Samba as a Domain Member](https://wiki.samba.org/index.php/Setting_up_Samba_as_a_Domain_Member).
1. Configure `krb5.conf` so that the Kerberos key distribution center (KDC) with the domain server can be contacted for authentication. For more information, see [MIT Kerberos Documentation](https://web.mit.edu/kerberos/krb5-1.12/doc/admin/conf_files/krb5_conf.html). Here's a sample `krb5.conf` file.
279
+
1. Configure `/etc/krb5.conf` so that the Kerberos key distribution center (KDC) with the domain server can be contacted for authentication. For more information, see [MIT Kerberos Documentation](https://web.mit.edu/kerberos/krb5-1.12/doc/admin/conf_files/krb5_conf.html). Here's a sample `/etc/krb5.conf` file.
> This example is for Azure AD DS, for which we recommend setting `backend = rid` when configuring idmap. On-premises AD DS users might prefer to [choose a different idmap backend](https://wiki.samba.org/index.php/Setting_up_Samba_as_a_Domain_Member#Choosing_an_idmap_backend).
3. Force winbind to reload the changed config file.
308
340
309
341
```bash
310
-
localadmin@contosovm:~$ sudo smbcontrol all reload-config
342
+
sudo smbcontrol all reload-config
311
343
```
312
344
313
345
### Join the domain
314
346
315
347
1. Use the `net ads join` command to join the host to the Azure AD DS domain. If the command throws an error, see [Troubleshooting samba domain members](https://wiki.samba.org/index.php/Troubleshooting_Samba_Domain_Members) to resolve the issue.
316
348
317
349
```bash
318
-
localadmin@contosovm:~$ sudo net ads join -U contososmbadmin # user - garead
350
+
sudo net ads join -U contososmbadmin # user - garead
319
351
320
352
Enter contososmbadmin's password:
353
+
```
354
+
355
+
```output
321
356
Using short domain name -- CONTOSODOMAIN
322
357
Joined 'CONTOSOVM' to dns domain 'contosodomain.contoso.com'
323
358
```
324
359
325
360
2. Make sure that the DNS record exists for this host on the domain server.
@@ -337,21 +375,32 @@ If users will be actively logging into client machines or VMs and accessing the
337
375
338
376
### Set up nsswitch.conf
339
377
340
-
1. Now that the host is joined to the domain, you need to put winbind libraries in the places to look for when looking for users and groups. Do this by updating the passwd and group entries in `nsswitch.conf`. Run the command `sudo vim /etc/nsswitch.conf` and add the following entries to `nsswitch.conf`:
378
+
1. Now that the host is joined to the domain, you need to put winbind libraries in the places to look for when looking for users and groups. Do this by updating the passwd and group entries in `nsswitch.conf`. Use your text editor to edit `/etc/nsswitch.conf` and add the following entries:
341
379
342
-
```bash
380
+
```plaintext
343
381
passwd: compat systemd winbind
344
382
group: compat systemd winbind
345
383
```
346
384
347
-
2. Enable the winbind service to start automatically on reboot, and then restart the service.
385
+
2. Enable the winbind service to start automatically on reboot.
localadmin@contosovm:~$ getent group 'domain users'
433
+
```
434
+
435
+
```bash
436
+
getent group 'domain users'
437
+
```
438
+
439
+
```output
382
440
domain users:x:10513:
383
441
```
384
442
385
443
If the above doesn't work, check if the domain controller is reachable using the wbinfo tool:
386
444
387
445
```bash
388
-
localadmin@contosovm:~$ wbinfo --ping-dc
446
+
wbinfo --ping-dc
389
447
```
390
448
391
449
### Configure PAM for winbind
392
450
393
451
1. You need to place winbind in the authentication stack so that domain users are authenticated through winbind by configuring PAM (Pluggable Authentication Module) for winbind. The second command ensures that the homedir gets created for a domain user upon first login to this system.
0 commit comments