linux security and file permissions Flashcards
what does /etc/passwd store ?
stores the user account records.
Each line of text contains one user account record.
Fields in each record are delimited by colons.
what are the fields in /etc/passwd user account records
user name
user password
user identifier (uid)
group identifier (gid)
gecos field
home directory
shell program
description of User name
This field contains the user name used to log into the system.
description of user password
This field contains the hash value of the user password. If the value is set to set to “x”, the actual password is stored in a separate shadow password file.
description of User identifier
(UID)
This field contains a number used internally by the system to identify the user.
description of group identifier
This field contains a number which identify the primary group of the user. All files
that are created by this user initially belong to this group.
description of gecos field
This field contains comments describing the account.
description of Home directory
This field contains the home directory of the user.
description of Shell program
This field contains the shell program to start when the user logs into the system.
what are the field names in etc/shadow.
user name
passwords
last change
minimum
maximum
warning
inactive
expire
what does cat /etc/shadow | tail -n 1
returns the last line of the contents of the shadow password file.
shadow file contains a hash for each user and therefore the last line is not very meaningful
what does cat /etc/shadow | head -n 1
returns the first line of the contents of the shadow password file.
what does cat /etc/shadow | tail -n 1 | tr “:” “\n”
cat /etc/shadow | tail -n 1 | tr “:” “\n” will display the last line of the contents of the shadow password file, with each field separated by a colon (“:”) replaced with a newline.
how to check if user login is disabled ?
use the grep “guest” /etc/shadow
if it return something like this
guest:!!::43nijnroi32
the !! means user login is disabled
how to lock the passwd for guest
passwd -l guest
to verify use the grep “guest” /etc/shadow
if it return something like this
guest:!!::43nijnroi32
the !! means user login is disabled