Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to add a new user named 'john'.
Bash Scripting
sudo useradd [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to create the home directory with '-m'.
Using only the username without options.
✗ Incorrect
The '-m' option creates the user's home directory when adding the user 'john'.
2fill in blank
mediumComplete the code to delete a user named 'alice' and remove her home directory.
Bash Scripting
sudo userdel [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Deleting the user without removing the home directory.
Using incorrect options like '-d' which is not valid here.
✗ Incorrect
The '-r' option removes the user's home directory and mail spool when deleting the user.
3fill in blank
hardFix the error in the script that locks the user account 'bob'.
Bash Scripting
sudo passwd [1] bob Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-u' which unlocks the account instead.
Using '-d' which deletes the password.
✗ Incorrect
The '-l' option locks the user account by disabling the password.
4fill in blank
hardFill both blanks to create a user 'carol' with home directory and bash shell.
Bash Scripting
sudo useradd [1] [2] carol
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-d' instead of '-m' for home directory.
Not specifying the shell option.
✗ Incorrect
Use '-m' to create the home directory and '-s' to specify the shell.
5fill in blank
hardFill all three blanks to create a user 'dave' with home directory, bash shell, and add to group 'developers'.
Bash Scripting
sudo useradd [1] [2] [3] dave
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to add the user to the 'developers' group.
Using the shell path as an option instead of a value.
✗ Incorrect
Use '-m' for home directory, '-s' to set shell, and '-G' to add to groups.