Linux Flashcards
(32 cards)
Where would you find user account information?
File Location
/etc/passwd
Where would you find account password hashes?
File Location
/etc/shadow
pwck
Command
Verifies each line in the /etc/passwd
and /etc/shadow
files and identifies discrepencies.
pwconv
Command
Adds the necessary information to synchronize the /etc/passwd
and /etc/shadow
files.
Where would you find group information?
File Location
/etc/group
Where would you find the default values used by the useradd
command?
/etc/default/useradd
/etc/login.defs
Reminder
The /etc/login.defs
file contains:
- Values used for the group and user ID numbers.
- Parameters for password encryption in the shadow file.
- Password expiration values for user accounts.
/etc/skel
Reminder
The /etc/skel
directory contains a set of configuration file templates that are copied into a new user’s home directory when it is created, including the following files:
- .bashrc
- .bash_logout
- .bash_profile
- .kshrc
useradd
Command
Adds a new user.
useradd -c
Option
Adds a description for the account in the GECOS field.
This changes the full name of the account.
useradd - m
Option
Creates the user’s home directory (if it does not exist)
useradd
Option List
- -c adds a description for the account in the GECOS field of /etc/passwd.
- -d assigns an absolute pathname to a custom home directory location.
- -D displays the default values specified in the /etc/default/useradd file.
- -e specifies the date on which the user account will be disabled.
- -f specifies the number of days after a password expires until the account is permanently disabled.
- -M defines the secondary group membership.
- -m creates the user’s home directory (if it does not exist).
- -n does not create a group with the same name as the user (Red Hat and Fedora, respectively).
- -p defines the encrypted password.
- -r specifies that the user account is a system user.
- -s defines the default shell.
- -u assigns the user a custom UID. This is useful when assigning ownership of files and directories to a different user.
passwd
Command
Assigns or changes a password for a user.
passwd
Option List
- -S username displays the status of the user account. LK indicates that the user account is locked, and PS indicates the user account has a password.
- -l disables (locks) an account. This command inserts a !! before the password in the /etc/shadow file, effectively disabling the account.
- -u enables (unlocks) an account.
- -d removes the password from an account.
- -n sets the minimum days before a password can be changed.
- -x sets the number of days before a user must change the password (password expiration time).
- -w sets the number of days before the password expires that the user is warned.
- -t sets the number of days following the password expiration that the account will be disabled.
usermod
Command
Modifies an existing user account.
usermod
Option List
- -c changes the description for the account.
- -l renames a user account.
- -L locks the user account. This command inserts a ! before the password in the /etc/shadow file, effectively disabling the account.
- -U unlocks the user account.
userdel
Command
Removes a user account.
userdel -r
Option
Removes the user’s home directory.
userdel
Option List
-
userdel [username]
(without options) removes the user account. - -r removes the user’s home directory.
- -f forces removing the user account even when the user is logged into the system.
chage
Command
Sets user passwords to expire.
chage
Option List
- -M sets the maximum number of days before the password expires.
- -W sets the number of days before the password expires that a warning message displays.
- -m sets the minimum number of days that must pass after a password has been changed before a user can change the password again.
ulimit
Command
Limits computer resources used for applications launched from the shell. Limits can be hard or soft. Users can modify soft limits, but only the root user can modify hard limits.
ulimit
Option List
- -c limits the size of a core dump file. The value is in blocks.
- -f limits the file size of files created using the shell session. The value is in blocks.
- -n limits the maximum number of files that can be opened.
- -t limits the amount of CPU time a process can use. This is set in seconds.
- -u limits the number of concurrent processes a user can run.
- -d limits the maximum amount of memory a process can use. The value is in kilobytes.
- -H sets a hard resource limit.
- -S sets a soft resource limit.
- -a displays current limits. The default shows soft limits.
groupadd
Command
Creates a new group.