Back to Blog
Linux AD Machine Password Rotation: A Safe Cleanup Checklist

Linux AD Machine Password Rotation: A Safe Cleanup Checklist

   Mariusz Antonik    Security    8 min read    18 views

A compliance scan can produce a confusing result on Linux systems joined to Active Directory: the computer object has PasswordNeverExpires enabled, yet its password timestamp changes every few weeks. Those facts are not necessarily contradictory. The directory flag and the Linux client's password-renewal process are separate pieces of state, so the first task is to verify what the host is actually doing before changing anything in bulk.

This checklist gives developers and small IT teams a safe way to investigate the mismatch. It treats the flag as configuration drift that deserves correction, while keeping authentication health—not a single attribute—as the deciding signal.

Understand the three states that are being mixed together

Start by separating three questions:

  • Directory policy state: Does the AD computer object's userAccountControl value include the DONT_EXPIRE_PASSWORD bit, shown by PowerShell as PasswordNeverExpires = True?
  • Credential age: When was the machine-account password last changed in AD?
  • Client health: Can the Linux host use its current keytab to authenticate, and is SSSD's renewal task succeeding?

A scanner may inspect only the first item. SSSD can still renew the machine credential according to its local configuration, which explains why a supposedly non-expiring account can have a recent password-change timestamp. The finding may therefore be real configuration drift without being proof of a broken trust relationship.

Why the flag may still appear

Older join tooling and inherited automation are common causes. A long-lived Ansible role, shell wrapper, image build, or configuration-management template may still request a non-expiring computer password. A manually cloned computer object, delegated join process, or follow-up directory script can also set the bit after the host joins.

Do not assume that a new operating-system build means a new join path. Organizations often modernize packages while preserving a years-old command line in automation. Capture the exact join command and package versions from a newly built test host, then inspect every layer that can alter the computer object:

  • realmd or adcli arguments in provisioning roles;
  • golden-image and first-boot scripts;
  • Puppet, Ansible, Salt, or other policy templates;
  • directory-side remediation and identity-management jobs;
  • manual runbooks used by separate teams or service desks.

Search specifically for options or scripts that request a non-expiring password, but also compare the object immediately after a clean test join and again after configuration management runs. That timeline identifies which system introduced the change.

Verify that SSSD rotation is genuinely healthy

SSSD commonly checks machine-account password age on a scheduled basis and uses the configured AD integration helper to renew it. The default maximum age is often 30 days, but the effective value must be read from the host rather than assumed.

  1. Inspect the active domain section in /etc/sssd/sssd.conf for ad_maximum_machine_account_password_age. A value of 0 disables automatic renewal.
  2. Confirm the installed SSSD, realmd, and adcli package versions.
  3. Review SSSD logs for recent machine-password renewal attempts and failures.
  4. Compare the AD password-change timestamp with the expected renewal interval.
  5. Validate the host keytab and perform a Kerberos authentication test using an appropriate machine principal.
  6. Confirm that DNS, time synchronization, domain-controller discovery, and network access are healthy.

A recent directory timestamp is useful evidence, but it is not enough by itself. The keytab on disk and the secret stored in AD must match. A rotation can partially fail—for example, after the directory update but before a local keytab replacement—so include a real authentication test in the pilot.

Inventory the estate before remediation

Build an inventory rather than applying one broad command to an entire organizational unit. For each Linux computer account, collect:

  • computer name, distinguished name, operating system, and owning team;
  • PasswordNeverExpires state and raw userAccountControl value;
  • password-last-set timestamp and age in days;
  • last logon or another approved freshness indicator;
  • SSSD or Winbind ownership of machine-password renewal;
  • configured renewal age and recent renewal result;
  • keytab authentication result and last successful health check;
  • whether the account belongs to a cluster, appliance, template, or decommissioned host.

This prevents active servers, stale objects, appliances, and machines managed by a different stack from being treated as one population. It also creates a rollback and exception record for the change.

Do not mix SSSD and Winbind assumptions

Mixed estates require separate cohorts. SSSD and Samba/Winbind can have different defaults, helper processes, storage locations, and renewal intervals. A setting that describes an SSSD host does not prove how a Winbind host behaves.

Group systems by join and renewal mechanism before deciding what “healthy” means. If Samba services also rely on a separate machine-secret database, confirm that the selected renewal method keeps all required credential stores synchronized. Test domain membership, Kerberos authentication, and any SMB role that depends on the machine account.

Is clearing PasswordNeverExpires usually disruptive?

On a host where SSSD is already rotating the machine password successfully, clearing the directory flag should not itself force an immediate password reset or rewrite the local keytab. It changes the account attribute; it does not replace the current secret. That makes the change low risk for a verified healthy host, but “low risk” is not the same as “safe to run everywhere without testing.”

The main hazards are hidden exceptions: a system whose rotation is disabled, a stale keytab, a different join stack, an offline machine, or automation that promptly sets the bit again. Clearing the flag without fixing the source also creates a recurring compliance loop.

Use a staged cleanup plan

  1. Fix the source first. Remove the non-expiring-password request from join automation and confirm that a newly joined test object is created with the expected attributes.
  2. Select a pilot cohort. Choose a small set of non-critical SSSD hosts with recent rotations, valid keytabs, clear ownership, and current backups or rebuild procedures.
  3. Record before-state. Export object identity, flag state, password age, host configuration, and authentication-test results.
  4. Clear only the intended property. Use an approved directory-management path such as PowerShell's Set-ADComputer -PasswordNeverExpires $false against an explicit reviewed list. Avoid a broad OU filter during the pilot.
  5. Test immediately. Verify Kerberos authentication, domain identity lookups, SSSD health, and the production service's normal access path.
  6. Observe through a renewal cycle. Confirm that the next scheduled rotation succeeds and the flag stays cleared.
  7. Expand in batches. Use change windows, batch limits, clear owners, and stop conditions.
  8. Reconcile the result. Report changed, skipped, failed, and reverted objects rather than treating command completion as proof of success.

Example discovery and change controls

PowerShell can produce a reviewable inventory from a narrowly scoped search base. Adapt attribute names and filters to your directory standards:

Get-ADComputer -SearchBase "OU=Linux,DC=example,DC=com" -Filter * \
  -Properties PasswordNeverExpires,PasswordLastSet,OperatingSystem |
  Select-Object Name,DistinguishedName,OperatingSystem,
                PasswordNeverExpires,PasswordLastSet |
  Export-Csv .\linux-computer-password-audit.csv -NoTypeInformation

After owners verify the list, feed only approved distinguished names or computer names into the change. Add -WhatIf where supported during review, retain a transcript, and stop on unexpected scope or error rates. Do not copy a bulk command directly into production without your normal change approval and a tested recovery path.

What to monitor after the cleanup

Effective linux server monitoring should connect directory state with host evidence. A useful weekly check can include:

  • machine-account password age versus the configured maximum;
  • renewal task success or failure from SSSD logs;
  • keytab authentication result;
  • clock offset and domain-controller reachability;
  • unexpected return of PasswordNeverExpires;
  • stale computer objects and hosts missing recent reports;
  • package or configuration changes affecting SSSD, adcli, realmd, or Samba;
  • differences between expected and actual join-policy configuration.

Alert immediately when authentication breaks or rotation repeatedly fails. Put slower-moving drift—password age approaching a limit, a returned flag, or inconsistent configuration—into a concise periodic report. That division catches risk without turning every directory attribute into an interruption.

Define success in operational terms

The project is complete when new hosts join with the correct setting, existing healthy hosts retain working trust after remediation, exceptions are documented, and monitoring detects regressions. A clean compliance scan is one outcome, not the only outcome.

For a small team, the durable solution is simple: one owned join workflow, one documented renewal mechanism per cohort, staged directory changes, and evidence that the keytab actually works. That turns an ambiguous flag into a controlled maintenance task rather than a risky estate-wide guess.

Want weekly Linux and MySQL health checks without dashboard fatigue?

DMCloud Architect turns infrastructure signals into a practical weekly report, highlighting configuration drift, credential risks, capacity trends, and recommended next steps without asking you to watch another dashboard.

Get the free starter plan for weekly infrastructure health reports.

About the Author
Mariusz Antonik

Oracle Cloud Infrastructure expert and consultant specializing in database management and automation.

All Tags
#active-directory #adcli #Advanced #agent-visibility #agentless-monitoring #alerts #amazon-linux-2023 #argo-cd #asset-inventory #atop #auditd #automation #backend-infrastructure #backup-setup #backup-verification #backups #bandwidth-monitoring #bare-metal-server #Bash #bash cpu monitoring script #bash monitoring #bash scripting #bash-automation #bash-scripts #Beginner #Best Practices #bind-dns #block volume backup #brute-force-protection #Capacity Planning #centos-7 #centos-ftp-migration #centralized-logging #chromebook-linux #cifs-mounts #cloud backup strategy #cloud-costs #cloud-database-setup #cloud-networking #cloudflare-workers #cluster-administration #compute #container-monitoring #control-panel-security #cpu bottleneck #CPU Monitoring #cpu monitoring linux #cpu monitoring script linux #cpu trends #cpu usage trends #cpu usage trends linux #cpu-monitoring-script #cpu-monitoring-without-tools #cpu-performance-decline-server #cpu-performance-degradation-linux #cpu-performance-trends-linux #cpu-reporting-linux-server #cpu-usage-history-linux #create oracle db system in oci #cron #cron cpu monitoring #cron cpu monitoring linux #cron jobs #cron-monitoring #custom-linux-distribution #cve-advisory #database #database monitoring #database performance #database-health #database-migration #database-setup #debian #deployment-checklist #detect slow queries mysql #devops #devops-checklist #devops-help #devops-learning #disk capacity planning server #disk forecasting linux #disk growth trend linux #Disk Monitoring #disk usage #disk usage script linux #disk usage trends #disk-capacity #disk-growth #disk-saturation-detection-linux #disk-scaling-planning-linux #disk-usage-history-linux #dns-migration #dnssec #Early Detection #easy infrastructure monitoring #egress-monitoring #elasticsearch #exposed-port-monitoring #fail2ban #field-server-checklist #firewall-rules #fleet-ops #free-tier #freelance-sysadmin #gitops-security #growth-trends #Guide #health dashboards #Health Reporting #historical server monitoring #historical-monitoring #home-lab #how to monitor cpu usage linux #hpc #https-certificates #incident-response #infiniband #infrastructure #infrastructure health #infrastructure health dashboard #infrastructure health reporting #infrastructure monitoring #infrastructure monitoring report #infrastructure trends #infrastructure trends monitoring #Infrastructure Visibility #infrastructure-automation #infrastructure-checklist #infrastructure-reporting #interview-prep #ip-allowlist #iproute2 #journald #kubernetes-security #latency-checks #lightweight linux monitoring #lightweight monitoring #lightweight-monitoring-solution #linux #linux administration #linux cpu monitoring #linux cpu usage #linux disk capacity planning #linux disk usage #Linux monitoring #linux monitoring setup #linux monitoring tools #linux performance #linux performance monitoring #linux server #linux server monitoring #linux servers #linux storage #linux tools #linux-admin #linux-disk-monitoring #linux-file-sharing #linux-hardening #linux-hotspot #linux-monitoring-for-small-business #linux-networking #linux-performance-tuning #linux-remote-desktop #linux-security #linux-server-health #lmod #local-dns #local-network #log-management #log-retention #logrotate #loki #low maintenance monitoring #machine-password-rotation #mkcert #monitor cpu usage over time linux #monitor linux server health #monitor server trends #monitor small production server #monitor-server-trends-over-time #monitoring #monitoring without complexity #monitoring-agent #monitoring-for-lean-teams #monitoring-without-devops-team #MySQL #mysql health reporting #MySQL monitoring #mysql optimization #MySQL Performance #mysql performance degradation #mysql performance monitoring #mysql performance trends #mysql query performance issues #mysql server monitoring #mysql slow queries #mysql slow query analysis #mysql slow query monitoring #mysql trends #mysql-health #mysql-heatwave #mysql-indexing #mysql-monitoring-lightweight #mysql-monitoring-production #mysql-slow-query #mysql-workload-trends #network-automation #network-monitoring #networking #networkpolicy #node-express #nsg #observability #OCI #oci backup #oci bastion tutorial #oci block volume #oci infrastructure as code #OCI monitoring #oci networking #oci oracle database private subnet setup #oci oracle database tutorial #oci security #oci setup guide #oci terraform tutorial #oci tutorial for beginners #oci vcn terraform #oci virtual machine db system guide #oci-database #oci-mysql-heatwave #oci-mysql-heatwave-tutorial #oci-subnets #offline-pwa #openhpc #operations-checklist #oracle base database service tutorial #oracle cloud bastion #oracle cloud free tier tutorial #oracle cloud infrastructure step by step #oracle cloud infrastructure tutorial #oracle cloud storage #oracle database on oci setup #oracle-cloud #oracle-cloud-mysql-database-service #oracle-cloud-mysql-setup #oracle-cloud-vcn-setup #oracle-linux-9 #outbound-connections #patch-management #path-mtu-discovery #Performance #Performance Degradation #performance monitoring #performance trend monitoring #performance trends #ping-monitoring #plan disk growth server #plesk #practical server monitoring #predict disk usage growth #private instance access #process-monitoring #production-database #production-troubleshooting #prometheus #proxmox #query optimization #query-trends #remote-workstation-security #rhel-tuned #rollback #route-tables #rsyslog #rtnetlink #samba-server #Security #security lists #security-compliance #security-hardening #security-monitoring #selinux #server #server health #server health reporting #server health weekly report #server monitoring #Server Performance #server trend analysis #server-administration #server-audit #server-checklist #server-diagnostics #server-hardening #server-health-checklist #server-health-insights #server-management #server-security #server-security-audit #server-security-checklist #server-throughput #server-trends #server-troubleshooting #servers #service-worker #siem #simple cpu monitoring linux #simple linux monitoring #simple monitoring small business #simple monitoring system #simple ops monitoring #slow queries #slow query reporting mysql #slow-query-log #slurm #small business infrastructure #small business IT #small business servers #small infrastructure monitoring #small server monitoring #small-business-monitoring #small-business-security #small-business-tech #sosreport #source-built-linux #ssh #ssh bastion #ssh-security #sssd #storage capacity planning linux #storage monitoring #subnets #sysadmin-checklist #sysadmin-lab #syscall-monitoring #sysstat #System Health #system health reporting #system-monitoring #systemd #tcp-mtu-probing #tcp-tuning #terraform oci compute #terraform oracle cloud infrastructure #track-disk-growth-linux #Trend Monitoring #trend-analysis #trends #tuned-adm #Tutorial #ufw #uptime-checks #uptime-monitoring #vcn #vcn-design #vector #vps-management #vps-setup #vsftpd #vulnerability-response #wazuh #weekly-reports #weekly-server-report #windows-admin #windows-agent #windows-linux #xrdp