'Setting password expiry using chef 'user' resource

I am just trying to track down if it is possible to set the number of days before a users password is forced to changed (aka password expiry) using the Chef 'user' resource as per https://docs.chef.io/resource_user.html.

From my reading, it doesn't appear possible and that cheffers are creating their own cookbooks to do this.

Does anyone know how to do it, with "native" chef functionality?

Thanks.



Solution 1:[1]

This is not available in the core user resource, which just uses useradd and usermod on Linux. You would have to install/script the chage command or set some defaults in /etc/default/useradd or similar.

Solution 2:[2]

I found a cookbook by Rackspace that seems to do what you need. It's an add-on, but it could work for what you need -- or for anyone who wandered here on a search like me.

https://github.com/rackspace-cookbooks/user_shadow

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 coderanger
Solution 2 user2066657