# Domain Join and Samba Configuration
This document provides instructions for setting up a Linux machine to join an Active Directory (AD) domain, configure Kerberos authentication, set up Samba for file sharing, and use SSSD for managing domain users.
## Prerequisites
Ensure the following packages are installed on the system:
- `cifs-utils`: Mounts and manages SMB/CIFS shares.
- `chrony`: Synchronizes system time with servers.
- `samba`: Provides file and printer sharing.
- `samba-client`: Access and manage Samba shares.
- `samba-common`: Common Samba files and configuration.
- `samba-winbind`: Connects AD users and groups.
- `samba-winbind-clients`: Tools for AD authentication support.
- `krb5-workstation`: Kerberos client tools for authentication.
### Install Required Packages
sudo dnf install realmd sssd cifs-utils chrony samba samba-client samba-common samba-winbind samba-winbind-clients krb5-workstation
## Configuration Files
### 1. Kerberos Configuration (`/etc/krb5.conf`)
The `krb5.conf` file contains the Kerberos authentication settings. Ensure the following content is configured correctly for your environment:
#### /etc/krb5.conf
[logging]
default = FILE:/var/log/krb5libs.log
kdc = FILE:/var/log/krb5kdc.log
admin_server = FILE:/var/log/kadmind.log
[libdefaults]
default_realm = FOURCOFFEE.COM
dns_lookup_realm = false
dns_lookup_kdc = true
[realms]
FOURCOFFEE.COM = {
kdc = fc-dc-01.fourcoffee.com
admin_server = fc-dc-01.fourcoffee.com
}
[domain_realm]
.fourcoffee.com = FOURCOFFEE.COM
fourcoffee.com = FOURCOFFEE.COM
### 2. Samba Configuration (`/etc/samba/smb.conf`)
The `smb.conf` file configures Samba for sharing files and printers with AD users.
#### /etc/samba/smb.conf
workgroup = FOURCOFFEE
realm = FOURCOFFEE.COM
security = ads
encrypt passwords = yes
# Use winbind for domain users and groups
idmap config * : range = 10000-20000
idmap config FOURCOFFEE : backend = rid
idmap config FOURCOFFEE : range = 20001-30000
# Enable winbind to resolve users and groups
winbind use default domain = yes
winbind offline logon = yes
template shell = /bin/bash
template homedir = /home/%U
# Enable ACL Support
vfs objects = acl_xattr
map acl inherit = Yes
store dos attributes = Yes
# Enable Secure Kerberos Communication
client signing = mandatory
client schannel = yes
server signing = mandatory
server schannel = yes
[homes]
comment = Home Directories
valid users = %S, %D%w%S
browseable = No
read only = No
inherit acls = Yes
### 3. SSSD Configuration (`/etc/sssd/sssd.conf`)
The `sssd.conf` file is used for integrating with AD to manage user accounts and authentication.
#### /etc/sssd/sssd.conf
domains = fourcoffee.com
config_file_version = 2
services = nss, pam
[domain/fourcoffee.com]
default_shell = /bin/bash
krb5_store_password_if_offline = True
cache_credentials = True
krb5_realm = FOURCOFFEE.COM
realmd_tags = manages-system joined-with-adcli
id_provider = ad
fallback_homedir = /home/%u
ad_domain = fourcoffee.com
use_fully_qualified_names = False
ldap_id_mapping = True
access_provider = ad
ad_gpo_ignore_unreadable = True
ad_gpo_map_network = +nx
### 4. Chrony Configuration (Time Synchronization)
Ensure that your system clock is synchronized with the domain controllers using Chrony or any other time synchronization method.
## Steps
### 1. Join the Domain
Use the `realm` command to join the domain:
### 2. Start Services
Enable and start the required services:
sudo systemctl start sssd
sudo systemctl enable winbind
sudo systemctl start winbind
sudo systemctl enable nmb
sudo systemctl start nmb
sudo systemctl enable smb
sudo systemctl start smb
sudo systemctl enable chronyd
sudo systemctl start chronyd
### 3. Testing
- Verify Kerberos authentication:
kinit <domain-user>
klist
- Test domain users with `id` and `getent` commands:
id <domain-user>
getent passwd <domain-user>
## Notes
- Modify the domain-specific details (`FOURCOFFEE.COM`, `fc-dc-01.fourcoffee.com`) to match your environment.
- Ensure the firewall allows necessary ports for Samba and AD communication.
## Author
`fourcoffee.md` was created by [Udayakumar Rajendran] on [2024-10-09].
Comments
Post a Comment