passwd

linux

What is the format of the /etc/passwd file?

username:coded_password:UID:GID:userInformation:homeDirectory:shell

What are the advises regarding manipulating the /etc/passwd file?

  1. Always save make a backup copy of the /etc/passwd file before editing it
  2. Use vipw command to edit the password file
  3. Keep the passwd file in order of UID
  4. Use an asterisk to disable a user account

How can we create the shadow passwd file from /etc/passwd?

Use the pwconv utility.

How can we convert the shadow passwd file to the regular /etc/passwd file?

Use the pwunconv utility

Other information:

The maximum password lifetime setting specifies how long the user can keep the same password. The minimum password lifetime setting specifies how long the user must keep the password. Setting the two password aging characters to two periods force the user to change his password at next logon.

HPUX use SAM to enter password aging.

What is the format of the /etc/shadow file?

username:coded_password:lastChange:min_days:max_days:inactive_days:expired_date

What are the options for the passwd command?

-n    specifies the minimum in days
-x    specifies the maximum in days
-f    force the user to change the password at next login
-s    list password aging data for the specified user
-a    used with -s to list data for all users
-l    lock the account (lower-case letter L)
-d    delete the password for this user; no password is required to login
-i    set inactivity period before account lock out (in days) (Linux only)

passwd -n 1 -x 156 username    // minimum 1 day and maximum 158 days
passwd -x 0 username    // disable password aging and force user to change password at login
passwd -x -1 username    // turn off password aging for a user

How can we edit the password again policy for all users?

For SCO and Solaris, use the /etc/default/passwd file:

MAXWEEKS=26
MINWEEKS=0
WARNWEEKS=1
PASSLENGTH=8

For Linux, use the /etc/login.defs file:

PASS_MAX_DAYS 182
PASS_MIN_DAYS 0
PASS_WARN_AGE 7
PASS_MIN_LEN 8

What is the purpose of the /etc/shells file?

Contains valid shells. Only shells listed here is allowed to be used as the default login shell (from the /etc/passwd file). /etc/shells:

/bin/sh
/bin/csh
/bin/ksh
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License