ConfigFile class to read and write to /etc/passwd and /etc/shadow
Read /etc/shadow and assign each User() a ShadowEntry() object based on the found information. Also returns /etc/shadow as a list (useful for doing comparisons).
Note: We don’t use User.get_shadow_entry() to cut down on filesystem reads.
Data structure to store a user’s parameters in /etc/shadow.
Class for referencing and saving user properties (UID, GID, password, shell, etc)
Returns the user’s parameters as a list.
Note: Does not include self.shadow.
Creates and assigns a NEW ShadowEntry() object as self.shadow using default values.
Note: This is primarily for when you create a new User() object from scratch.
Creates a new ShadowEntry() object from the user’s parameters in /etc/shadow and assigns it to self.shadowobj.
Note: This should only be used when creating a new user from scratch outside of a PasswdFile() object.
Locks the user’s account by placing an asterisk (*) at the beginning of their password hash.
Example: ‘$1$6zC7IDVb$D0KADmAQwgy4thyPjrwn31’ becomes ‘*$1$6zC7IDVb$D0KADmAQwgy4thyPjrwn31’
This prevents the user from being able to use a password to login.