• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Enable Password Aging in Linux with NIS

by admin

In order to enable password aging in Linux, the shadow file is used. Password aging is not managed in the /etc/passwd file with Linux, unlike other systems.

1. In /etc/login.defs, define PASS_MAX_DAYS to 90 instead of the default 9999:

# vi /etc/login.defs
PASS_MAX_DAYS=90

The above data from /etc/login.defs is used by useradd command and it creates the users with the mentioned password age.

2. For existing users reset the password aging using the following comand:

# chage -M 90 username

3. Run the command authconfig and make sure shadow passwords are enabled. NIS by default will not build the shadow file. Edit the file /var/yp/Makefile and make the following changes:

# vi /var/yp/Makefile
MERGE_PASSWD=false

In the line all:, add shadow as follows:

all:  shadow passwd group hosts rpc services netid protocols mail

4. Run the makefile. It will create a new map shadow.

5. Now NIS holds the password aging information, which can be seen by the following command:

# ypcat shadow.byname | grep user

Filed Under: Linux

Some more articles you might also be interested in …

  1. CentOS / RHEL 7 : Unable To Start The Samba Service
  2. pvremove Command Examples in Linux
  3. CentOS / RHEL : How to view the commands executed in yum history command output
  4. “userdel: user xxx is currently used by process yyy” – Unable to delete an User
  5. How Files/Directories in /tmp gets Removed Automatically in CentOS/RHEL 5,6
  6. ClusterSSH(cssh) – Manage Multiple SSH Sessions on Linux
  7. Shopt: Not Found [No Such File Or Directory]
  8. Linux OS Service ‘named’
  9. Linux Interview Questions – Linux Printing (CUPS)
  10. Linux OS Service ‘avahi-daemon’

You May Also Like

Primary Sidebar

Recent Posts

  • qemu-system-x86_64: command not found
  • timedatectl: command not found
  • mpirun.openmpi: command not found
  • startkde: command not found

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright