Users and Groups Flashcards
Which file allows you delegate sudo privileges to users?
/etc/sudoers
Which editor is recommended to use when editing the sudoers file?
visudo
Why is visudo the recommended editor for editing sudoers?
Verifies syntax texts before committing changes
What is the visudo command to open the sudoers file?
sudo visudo /etc/sudoers
What does the -c flag for visudo do?
Check for file errors
What does the -f flag for visudo do?
Edits the file
What does the -s flag for visudo do?
Checks the file in strict mode
What does the -x flag for visudo do?
Outputs in JSON
What is PolicyKit?
PolicyKit is a Linux component that controls system-wide privileges that allows non-privileged processes to communicate with privileged ones
Example: pkexec mkdir Nick
What is the command to create a new user?
sudo useradd [options] [username]
What does the -c flag for useradd do?
Add a comment to the comment field
What does the -e flag for useradd do?
Sets an expiration date for the user
Example: useradd –e [yyyy][mm][dd] [username]
What does the -s flag for useradd do?
Sets the users default shell
Example: useradd –s /bin/ksh [username]
What does the -D flag for useradd do?
View the default configurations for new users
What is the command for the root user to change or reset the password for another user?
sudo passwd [username]
Newly created users are configured based on which file?
/etc/login.defs
What is the command to change a users expiration date?
sudo chage -E yyyy/mm/dd [user]
What is the command to run a previous command as sudo without typing the command out again?
sudo !!
What is the command to change the maximum days until a user must change their password?
sudo chage -M [days] [user]
What is the command to change the days until a user receives a warning before their password expires?
sudo chage -W [days] [user]
How do you display account aging information of a user?
sudo chage -l [user]
What is the command to change a users username?
sudo usermod -l [username]
How do you change a users username?
sudo usermod -l [newusername] [oldusername]
What is the command to lock a account?
sudo passwd -l [username]
What is the command to unlock a account?
sudo passwd -u [username]
What is the command to delete a user?
sudo userdel [username]
What is the command to delete a user, including their home directory?
sudo userdel -r [username]
What is the command to add a new group?
sudo groupadd [options] [groupname]
What does the -f flag groupadd do?
Exists if the group already exists
What does the -o flag groupadd do?
Creates a group with a non-unique id
What is the command to modify a groups attributes?
sudo groupmod [options] [group]
What is the command to modify a groups ID?
sudo groupmod -g [id] [groupname]
What is the command to rename a group?
sudo groupmod -n [newname] [oldname]
What is the command to delete a group?
sudo groupdel [options] [groupname]
What is the command to display the username currently logged into the system?
whoami
What is the command to display the details of users currently logged in
who
What is the command to display the details of users currently logged in to the system and their transactions?
w
What is the command to display the history of user login and logout actions, and the actual time and date?
last
Which file does the last command use to retrieve information?
/var/log/wtmp
What is the .bashrc file?
Enables customization of a users environment
What are two things that can be customized in the .bashrc file?
Default directories and permissions, default command prompt
What is the bash_profile file?
Provides the shell configuration for the initial login environment
What is the /etc/profile file?
Provides system-wide environmental variables that are used to apply certain settings to user accounts
~/.bash_profile
~/.bash_login
~/.profile
What is /etc/profile.d?
Serves as a storage location for scripts that admins may use to set additional system-wide variables