In Bash scripting, what does the && operator signify?

  • Logical AND operator
  • Pipe operator
  • Command substitution
  • Bitwise AND operator
In Bash scripting, the && operator signifies the logical AND operator. It is used to execute the command on the right-hand side only if the command on the left-hand side succeeds (returns a zero exit status). This allows for conditional execution of commands in a script.

You are a system administrator and notice that users are able to use simple passwords. Which tool or command would you use to enforce complex password policies?

  • passwd
  • chsh
  • pam_tally2
  • passwdqc
To enforce complex password policies, you can use the passwdqc tool. passwdqc is a password complexity checking and policy enforcement tool that can help you ensure that users create strong passwords by setting specific requirements such as length, character classes, and more.

The exit status of the last command executed is stored in the _________ variable.

  • $!
  • $@
  • $?
  • $_
The exit status of the last command executed is stored in the $? variable. This value is important for checking whether a command or script ran successfully (0) or encountered an error (non-zero).

Which command is used to lock a user's account in Linux?

  • passwd -l
  • usermod -L
  • lockuser -u
  • userlock -a
The correct command to lock a user's account in Linux is passwd -l. This command will place an "!" in front of the user's password hash in the /etc/shadow file, preventing them from logging in. It's a security measure to temporarily or permanently disable a user's account.

What does the $# variable represent in a shell script?

  • The number of arguments passed to the script
  • The exit status of the previous command
  • The process ID of the script
  • The current working directory
The $# variable in a shell script represents the number of arguments passed to the script. This is useful for determining how many arguments were provided when calling the script and for performing conditional logic based on the number of arguments.

Which directory would you inspect to view logs generated by system processes?

  • /etc
  • /opt
  • /proc
  • /var/log
You would inspect the /var/log directory to view logs generated by system processes. The /var/log directory contains log files for various system services, which can be helpful for troubleshooting and monitoring system behavior.

You're reviewing a shell script and notice that it uses a loop to process command-line arguments. Which special variable in shell scripting is typically used to handle this scenario?

  • $@
  • $*
  • $1
  • $ARG
In shell scripting, the special variable $@ is typically used to handle command-line arguments. It represents all the arguments passed to the script as an array. Using $@ allows you to iterate through and process each argument in a loop.

You have been tasked to allow only a specific IP address to connect to your SSH server. Which tool or method would be best suited to achieve this?

  • iptables
  • /etc/ssh/sshd_config
  • TCP Wrappers
  • /etc/hosts.allow
To allow only a specific IP address to connect to your SSH server, you can use TCP Wrappers. You can configure access control for SSH by adding the allowed IP address in the /etc/hosts.allow file, specifying the service you want to control, which in this case is SSH.

If you wanted to rate limit incoming SSH connections using iptables, which module would be most appropriate?

  • -m limit
  • -m state
  • -m connlimit
  • -m ssh
To rate limit incoming SSH connections using iptables, the most appropriate module is -m connlimit. This module allows you to set limits on the number of connections established within a specified time frame. It's useful for mitigating brute-force attacks on SSH.

Which network file system allows sharing files and printers among Linux and Windows systems?

  • Samba
  • NFS
  • CIFS
  • FTP
Samba is the network file system that allows sharing files and printers among Linux and Windows systems. It enables Linux systems to interact seamlessly with Windows networks, sharing resources across the platforms.