Class ShadowFile.Entry
java.lang.Object
com.aoindustries.aoserv.daemon.posix.ShadowFile.Entry
- Enclosing class:
ShadowFile
Represents one line of the
/etc/shadow file on a POSIX server.-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new shadow file entry for the given user.Entry(User.Name username, String password, int changedDate, Integer minPasswordAge, Integer maxPasswordAge, Integer warningDays, Integer inactivateDays, Integer expirationDate, String flag) Constructs a shadow file entry given all the values.Creates a new shadow file entry for the given user and encrypted password. -
Method Summary
Modifier and TypeMethodDescription<A extends Appendable>
AappendTo(A out) Appends thisShadowFile.Entryas it would be written in/etc/shadow, not including any newline.intThe days since Jan 1, 1970 password was last changed.static intGets the number of days from the Epoch for the current day.static intgetCurrentDate(long time) Gets the number of days from the Epoch for the provided time in milliseconds from Epoch.The days since Jan 1, 1970 when account will be disabled ornullif not set.getFlag()Reserved for future use,nullif not set.The days after password expires that account is considered inactive and disabled ornullif not set.The number of days until a password change is forced ornullif not set.The number of days until a password change is allowed ornullif not set.The encrypted password.The username the entry is for.The days before password is to expire that user is warned of pending password expiration ornullif not set.setPassword(String newPassword, Integer newChangedDate) Sets the encrypted password, optionally updating the changedDate.toString()Gets thisShadowFile.Entryas it would be written in/etc/shadow, not including any newline.
-
Constructor Details
-
Entry
public Entry(User.Name username, String password, int changedDate, Integer minPasswordAge, Integer maxPasswordAge, Integer warningDays, Integer inactivateDays, Integer expirationDate, String flag) Constructs a shadow file entry given all the values. -
Entry
Creates a new shadow file entry for the given user and encrypted password. -
Entry
Creates a new shadow file entry for the given user.
-
-
Method Details
-
getCurrentDate
public static int getCurrentDate()Gets the number of days from the Epoch for the current day. -
getCurrentDate
public static int getCurrentDate(long time) Gets the number of days from the Epoch for the provided time in milliseconds from Epoch. -
toString
Gets thisShadowFile.Entryas it would be written in/etc/shadow, not including any newline. -
appendTo
Appends thisShadowFile.Entryas it would be written in/etc/shadow, not including any newline.- Throws:
IOException- See Also:
-
getUsername
The username the entry is for. -
getPassword
The encrypted password. -
setPassword
Sets the encrypted password, optionally updating the changedDate.- Parameters:
newChangedDate- The new changeDate ornullto not alter- Returns:
- a new entry if the password changed or
thiswhen the password is the same
-
getChangedDate
public int getChangedDate()The days since Jan 1, 1970 password was last changed. -
getMinPasswordAge
The number of days until a password change is allowed ornullif not set. -
getMaxPasswordAge
The number of days until a password change is forced ornullif not set. -
getWarningDays
The days before password is to expire that user is warned of pending password expiration ornullif not set. -
getInactivateDays
The days after password expires that account is considered inactive and disabled ornullif not set. -
getExpirationDate
The days since Jan 1, 1970 when account will be disabled ornullif not set. -
getFlag
Reserved for future use,nullif not set.
-
