In Bash scripting, the ________ command is used to loop over a range of values.
- for
- while
- if
- echo
In Bash scripting, the for command is used to loop over a range of values. It allows you to execute a set of commands for each item in the specified range or list.
Which built-in variable in a shell script would you use to determine the number of positional parameters?
- $#
- $@
- $*
- $$
To determine the number of positional parameters passed to a shell script, you would use the built-in variable $#. It represents the count of arguments supplied to the script.
Which SSH configuration parameter specifies the maximum number of authentication attempts allowed per connection?
- MaxLoginAttempts
- MaxAuthTries
- AuthMaxRetries
- LoginAttempts
The SSH configuration parameter that specifies the maximum number of authentication attempts allowed per connection is MaxAuthTries. It can be set in the SSH server configuration file (sshd_config) to enhance security by limiting the number of failed login attempts.
Docker primarily deals with which kind of virtualization?
- Containerization
- Hypervisor-based virtualization
- Paravirtualization
- Emulation
Docker primarily deals with containerization, which is a lightweight form of virtualization. Containers share the host OS kernel, making them efficient and suitable for packaging and running applications.
You are setting up a new server and need to ensure that only specific users can SSH into the machine. Which configuration file would you modify to achieve this?
- /etc/ssh/sshd_config
- /etc/hosts.allow
- /etc/ssh/authorized_keys
- /etc/passwd
To restrict SSH access to specific users, you would modify the /etc/ssh/sshd_config file. This file contains the configuration options for the SSH server, including settings related to user access, authentication, and permissions.
What is the primary keyword to start a loop that will iterate a fixed number of times in shell scripting?
- for
- while
- repeat
- loop
The primary keyword to start a loop that will iterate a fixed number of times in shell scripting is for. The for loop allows you to specify the number of iterations and is commonly used for such purposes.
Which loop in shell scripting tests the condition before executing the body of the loop?
- while
- for
- until
- do-while
The while loop in shell scripting tests the condition before executing the body of the loop. It will repeatedly execute the loop body as long as the specified condition remains true.
In Linux, services that are set to restart automatically after a failure are said to be "_________".
- Resilient
- Autorestart
- Persistent
- Robust
In Linux, services that are set to restart automatically after a failure are said to be "Autorestart." This feature ensures that critical services can recover from failures and continue running, enhancing system reliability and availability.
Which command can be used to list currently loaded kernel modules?
- lsmod
- modprobe
- modinfo
- insmod
The command 'lsmod' is used to list currently loaded kernel modules in Linux. This command displays a list of all the kernel modules that are currently loaded into the running kernel.
In Linux, the ________ command can be used to see who has been granted sudo access.
- sudoers
- whoami
- visudo
- su
In Linux, the visudo command is used to see who has been granted sudo access. This command opens the sudoers file in a safe manner for editing and displays the sudo configuration. It's important to use visudo to avoid syntax errors in the sudoers file, which could lock you out of administrative access.