What is pool.ntp.org?
A deprecated feature for maintaining system time in the Linux kernel
A website which provides binary and source packages for the OpenNTPD project
A virtual cluster of various timeservers
A community website used to discuss the localization of Linux
C. pool.ntp.org is indeed a virtual cluster of various timeservers. It provides a reliable and easy-to-use NTP (Network Time Protocol) service for millions of clients worldwide. The pool.ntp.org project allows systems to synchronize their clocks with internet time servers, which are part of a large virtual cluster1.
References:
pool.ntp.org: the internet cluster of ntp servers, which explains the purpose and functioning of the pool.ntp.org project.
How do I setup NTP to use the pool?, which provides instructions on how to use pool.ntp.org for time synchronization.
NTP pool - Wikipedia, which offers additional information about the NTP pool and its role in time synchronization across the internet.
After configuring printing on a Linux server, the administrator sends a test file to one of the printers and it fails to print. What command can be used to display the status of the printer's queue? (Specify ONLY the command without any path or parameters.)
lpq, /usr/bin/lpq, lpstat, /usr/bin/lpstat
The command lpq can be used to display the status of the printer’s queue on a Linux server. The lpq command is part of the cups-bsd package, which provides the Berkeley commands for CUPS (Common UNIX Printing System), the standard printing system for Linux. The lpq command shows the status of a specified printer or the default printer if none is specified. It also lists the jobs that are queued for printing, along with their job IDs, owners, sizes, and names12. For example, to display the status of the printer lp1, we can use the following command:
$ lpq -P lp1
lp1 is ready
Rank Owner Job File(s) Total Size
active user1 123 test.txt 1024 bytes
1st user2 124 report.pdf 2048 bytes
The output shows that the printer lp1 is ready, and that there are two jobs in the queue, one of which is active and the other is waiting. The output also shows the owners, job IDs, file names, and sizes of the jobs. To display the status of all printers, we can use the -a option:
$ lpq -a
lp1 is ready
Rank Owner Job File(s) Total Size
active user1 123 test.txt 1024 bytes
1st user2 124 report.pdf 2048 bytes
lp2 is ready
no entries
The output shows that there are two printers, lp1 and lp2, and that lp2 has no entries in the queue. To display more information about the jobs, such as the priority, submission time, and status, we can use the -l option:
$ lpq -l -P lp1
lp1 is ready
Rank Owner Job File(s) Total Size
active user1 123 test.txt 1024 bytes
priority 50 Apr 27 10:00 processing since Apr 27 10:01
1st user2 124 report.pdf 2048 bytes
priority 50 Apr 27 10:05 waiting for lp1
The output shows that the jobs have the same priority, and that the first job is processing while the second job is waiting. The lpq command can be useful for troubleshooting printing problems, such as checking if the printer is ready, if there are any stuck or failed jobs, or if there are any conflicts or delays in the queue34. References: 1: lpq(1) - Linux manual page 2: How to Use the lp Command in Linux to Print Files From Terminal - Make Tech Easier 3: Linux sysadmin printing reference guide - PenguinTutor 4: How to manage print jobs on Linux - Network World
Which option in the /etc/ntp.conf file specifies an external NTP source to be queried for time information? (Specify ONLY the option without any values or parameters.)
server
The server option is used to configure a persistent association with a remote server or peer. It takes an argument that is either a host name or a numeric IP address of the NTP server. The ntpd daemon will periodically send NTP packets to the specified server and adjust the local clock according to the received responses. Multiple server options can be used to specify more than one NTP source. For example, the following lines in the /etc/ntp.conf file configure four external NTP sources:
server 0.asia.pool.ntp.org
server 0.oceania.pool.ntp.org
server 0.europe.pool.ntp.org
server 0.north-america.pool.ntp.org
References:
https://docs.ntpsec.org/latest/ntp_conf.html
https://vceguide.com/which-option-in-the-etc-ntp-conf-file-specifies-an-external-ntp-source-to-be-queried-for-time-information-2/
https://vceguide.com/which-option-in-the-etcntp-conf-file-specifies-an-external-ntp-source-to-be-queried-for-time-information/
Which of the following commands is used to rotate, compress, and mail system logs?
rotatelog
striplog
syslogd --rotate
logrotate
logger
The logrotate command is a tool for rotating, compressing, and mailing system logs. It is designed to ease the administration of systems that generate large numbers of log files. It allows automatic rotation, compression, removal, and mailing of log files. Each log file may be handled daily, weekly, monthly, or when it grows too large. Normally, logrotate is run as a daily cron job1. The logrotate command reads the configuration files specified on the command line or in the /etc/logrotate.conf and /etc/logrotate.d directories. These configuration files can set global options and specify log files to rotate and how to handle them. For example, the compress option enables compression of old log files, the mail option sends the log files to a specified email address before being rotated, and the rotate option sets the number of log files to keep12. The logrotate command is part of the LPI’s multi-level Linux professional certification program, and it is covered in the topic 106.1 System logging of the exam 102 objectives3. References: 1: logrotate(8) - Linux man page 2: logrotate command in Linux with examples - Linux command line tutorial 3: Exam 102 Objectives
Which file inside the CUPS configuration directory contains the definition of the printers?
cups-devices.conf
snmp.conf
printcap.conf
printers.conf
cupsd.conf
The printers.conf file inside the CUPS configuration directory contains the definition of the printers. It is a text file that lists the names, locations, descriptions, and options for each printer queue. Each printer queue has a corresponding
cups-files.conf - file and directory configuration file for cups
[printers.conf - printer configuration file for cups]
Which file, when using Sendmail or a similar MTA system, will allow a user to redirect all their mail to another address and is configurable by the user themselves?
/etc/alias
~/.alias
/etc/mail/forwarders
~/.forward
~/.vacation
The ~/.forward file is a file that users can create in their home directories to redirect mail or send mail using sendmail or a similar MTA system. The file contains a list of recipient addresses, which can be email addresses, file names, program names, or :include: files. The file must be owned by the user and have the read permission bit set for the owner. The file cannot be a symbolic link or have more than one hard link. The file is processed by sendmail when a recipient address selects a delivery agent with the F=w flag set. If the file contains a backslash, further processing is disabled and the message is delivered to the user’s mail-spooling directory. If the file does not exist or cannot be read, it is silently ignored. The ~/.forward file is different from the /etc/aliases file, which is a system-wide file that maps aliases to one or more recipient addresses. The /etc/aliases file is maintained by the system administrator and requires running the newaliases command after any changes. The ~/.alias file is not a valid file for sendmail or similar MTA systems. The /etc/mail/forwarders file is not a standard file for sendmail or similar MTA systems. The ~/.vacation file is a file that contains a vacation message that is sent to the sender when the user is away. The ~/.vacation file is used in conjunction with the vacation program, which can be invoked from the ~/.forward file. References:
Which of the following are commonly used Mail Transfer Agent (MTA) applications? (Choose THREE correct answers.)
Postfix
Procmail
Sendmail
Exim
SMTPd
Postfix, Sendmail, and Exim are three of the most commonly used Mail Transfer Agent (MTA) applications on Linux systems. An MTA is a software that transfers and routes electronic mail messages from one computer to another using the Simple Mail Transfer Protocol (SMTP). An MTA receives messages from another MTA or from a Mail User Agent (MUA), which is a computer application that end users use to access or send emails. An MTA can also query the MX records of the recipient’s domain to find the destination mail server and forward the message accordingly. An MTA can also perform other functions such as filtering, encryption, authentication, and bounce handling.
Postfix is a cross-platform, popular MTA that was designed and developed by Wietse Zweitze Venema for his mail server while working at the IBM research department. It was primarily developed as an alternative to well-known and popular Sendmail MTA. Postfix runs on Linux, Mac OSX, Solaris, and several other Unix-like operating systems. It borrows a lot of Sendmail properties on the outside, but it has a totally and comprehensively distinct internal operation. Additionally, it bids to be fast in performance with easy configurations and secure operation mechanism1.
Sendmail, now known as Proofpoint (after Proofpoint, Inc acquired Sendmail, Inc), is by far the most popular and one of the oldest MTA on the Linux server platform. Sendmail has a lot of limitations though, in comparison to modern MTAs. Because of its complicated configuration steps and demands, and weak security mechanisms, many new MTAs have come up as alternatives to Sendmail, but importantly, it offers everything to do with mail on a network1.
Exim is a free MTA developed for Unix-like operating systems such as Linux, Mac OSX, Solaris, and many more. Exim offers a great level of flexibility in routing mail on a network, with outstanding mechanisms and facilities for incoming mail monitoring. Its notable features include among others: no support for POP and IMAP protocols, supports protocols such as RFC 2821 SMTP and RFC 2033 LMTP email message transport, configurations include access control lists, content scanning, encryption, routing controls among others1.
Procmail is not an MTA, but a mail processing utility that can be used to filter, sort, and deliver incoming mail. It can be invoked by an MTA or run as a standalone program. Procmail can process mail based on various criteria such as sender, subject, header, body, size, date, and more. It can also execute external programs, forward mail to another address, or write mail to a file.
SMTPd is not an MTA, but a generic name for a daemon (a background process) that implements the SMTP protocol. A daemon is a program that runs continuously and performs certain tasks at predefined times or in response to certain events. An SMTP daemon listens for incoming SMTP connections from other MTAs or MUAs and handles the mail transfer accordingly. SMTPd can also refer to a specific SMTP daemon that is part of the OpenSMTPD project, which is a free implementation of the SMTP protocol for Unix systems. References:
7 Best Mail Transfer Agents (MTA’s) for Linux
Mail Transfer Agent (MTA) Explained | Mailtrap Blog
What is a Message Transfer Agent (MTA)? - Definition from Techopedia
Mail Transfer Agent (MTA) – Glossary of Email Terms | Mailgun
[Procmail - Wikipedia]
[SMTP daemon - Wikipedia]
Which of the following are syslog facilities? (Choose TWO correct answers.)
local5
advanced
postmaster
remote
The syslog facilities are predefined categories of messages that can be used to classify the source and type of the log events12. The syslog facilities are defined by the syslog protocol and are standardized across different implementations of syslog12. The syslog facilities are:
auth: Security and authorization messages, such as login failures or sudo usage12.
authpriv: Same as auth, but used for private security messages that should not be available to all users12.
cron: Messages from the cron daemon, such as scheduled jobs or errors12.
daemon: Messages from system daemons, such as sshd or ntpd12.
kern: Messages from the kernel, such as boot messages or hardware errors12.
lpr: Messages from the line printer subsystem, such as print jobs or errors12.
mail: Messages from the mail subsystem, such as sendmail or postfix12.
news: Messages from the network news subsystem, such as news servers or clients12.
syslog: Messages generated internally by the syslog daemon, such as configuration errors or restarts12.
user: Messages from user-level processes, such as applications or scripts12.
uucp: Messages from the Unix-to-Unix copy subsystem, such as file transfers or errors12.
local0 to local7: Custom facilities that are not used by any system processes and can be assigned to user applications or scripts123.
Therefore, the correct answers are A. local7 and B. mail, as they are both valid syslog facilities. The other options are not syslog facilities and are either made up (C. advanced and E. remote) or refer to a specific process rather than a category of messages (D. postmaster).
References: 1: Prepare for LPIC-1 exam 2 - topic 108.2: System logging - IBM Developer Tutorial 2: 108.2 System logging - Linux Professional Institute Certification Programs 3: What is the local6 (and all other local#) facilities in syslog?
After adding a new email alias to the configuration, which command must be run in order to ensure the MTA knows about it? (Specify the command without any path but including all required parameters.)
newaliases, sendmail -bi
The command that must be run in order to ensure the MTA knows about the new email alias is:
newaliases
This command updates the MTA’s aliases database and makes the changes effective. It is equivalent to the commands sendmail -bi or sendmail -I12. The newaliases command should be run after making modifications to the /etc/aliases file, which contains the email aliases for the system3.
What is true regarding the file ~/.forward?
As it is owned by the MTA and not writable by the user, it must be edited using the editaliases command.
After editing ~/.forward the user must run newaliases to make the mail server aware of the changes.
Using ~/.forward, root may configure any email address whereas all other users may configure only their own addresses.
When configured correctly, ~/.forward can be used to forward each incoming mail to more than one other recipient.
The file ~/.forward is a text file that contains one or more email addresses to which the incoming mail for the user will be forwarded123. The file is owned by the user and can be edited with any text editor123. The file does not require any special syntax or commands, just a list of email addresses separated by commas or newlines123. For example, if the user wants to forward their mail to alice@example.com and bob@example.com, they can create a ~/.forward file with the following content:
alice@example.com, bob@example.com
The MTA will read the ~/.forward file and send a copy of each incoming mail to the specified addresses123. Therefore, the correct answer is D. When configured correctly, ~/.forward can be used to forward each incoming mail to more than one other recipient.
The other options are false regarding the file ~/.forward. The file is not owned by the MTA and does not need to be edited with the editaliases command, which is used to edit the system-wide aliases file, not the user-specific ~/.forward file4. The user does not need to run newaliases to make the MTA aware of the changes, as the MTA will check the ~/.forward file every time a mail is delivered to the user123. The newaliases command is used to rebuild the system-wide aliases database, not the user-specific ~/.forward file4. The file ~/.forward does not have any restrictions on the email addresses that can be used for forwarding, as long as they are valid and reachable123. The root user can also use the ~/.forward file to forward their mail, but it is not recommended for security reasons.
References: 1: LPIC 102 – Configure e-mail aliases and forwarding on Linux using MTA - TechViewLeo 2: topic 108.3: Mail transfer agent (MTA) basics - IBM Developer 3: 108.3 Mail Transfer Agent (MTA) basics - Linux Professional Institute … 4: Linux At, Batch, Atq, Atrm Command Help and Examples - Computer Hope : [How to forward root’s email to another email address - nixCraft]
Which of the following is observed and corrected by a NTP client?
The skew in time between the system clock and the hardware clock.
The skew in time between the system clock and the reference clock.
Changes in the time zone of the current computer's location.
Adjustments needed to support Daylight Saving Time.
The Network Time Protocol (NTP) is a protocol that enables the accurate synchronization of time and date information across networked computer systems. NTP uses a hierarchical system of time servers, where each server has a stratum level that indicates its distance from the primary reference source. The primary reference source is usually an atomic clock or a GPS receiver, which provides the Coordinated Universal Time (UTC). The NTP clients are the computer systems that want to synchronize their system clocks with the UTC. The system clock is a software clock that runs in the kernel and keeps track of the current time and date. The system clock can be influenced by various factors, such as the hardware clock, the CPU frequency, the temperature, the load, and the network latency. These factors can cause the system clock to drift or skew from the UTC, resulting in inaccurate timekeeping. A NTP client observes and corrects the skew in time between the system clock and the reference clock, which is the clock of the NTP server that the client is connected to. The NTP client periodically sends requests to the NTP server and receives the server’s time stamps. The NTP client then calculates the offset and the round-trip delay between its system clock and the reference clock, and adjusts its system clock accordingly. The NTP client can also use multiple NTP servers and apply algorithms to select the best one and filter out outliers. The NTP client can also discipline the system clock by using a feedback loop that controls the clock frequency and reduces the clock drift. By using NTP, the system clock can achieve a high accuracy and precision, usually within a few milliseconds or microseconds of the UTC123.
The other options are not correct. The skew in time between the system clock and the hardware clock is not observed and corrected by a NTP client, but by a separate utility called hwclock, which can read and set the hardware clock. The hardware clock is a battery-powered device that keeps time even when the system is powered off. The hardware clock is usually less accurate than the system clock, and can be synchronized with the system clock at boot or shutdown time. The changes in the time zone of the current computer’s location are not observed and corrected by a NTP client, but by a configuration tool called timedatectl, which can set the system time zone and other parameters. The time zone is a geographical region that has a uniform standard time and date. The time zone does not affect the system clock, which always keeps the UTC, but only the display of the local time and date for the user. The adjustments needed to support Daylight Saving Time (DST) are not observed and corrected by a NTP client, but by the system’s time zone database, which contains the rules and transitions for DST. DST is a practice of advancing the clocks by one hour during summer months to make better use of daylight. DST is not observed in all regions and countries, and can vary in start and end dates. The system’s time zone database is updated regularly to reflect the changes in DST rules, and can be applied to the system clock to calculate the correct local time and date. References: 1: Network Time Protocol - Wikipedia 2: How NTP Works - NTP Pool Project 3: How To Set Up Time Synchronization on Ubuntu 20.042 : hwclock(8) - Linux manual page : timedatectl(1) - Linux manual page : Daylight saving time - Wikipedia
Which of the following parameters are used for journalctl to limit the time frame of the output? (Choose TWO correct answers.)
--from=
--since=
--until=
--upto=
--date=
The journalctl command is a tool for viewing and filtering the systemd journal logs. It accepts various parameters to control the output format, the source of the logs, and the filtering criteria. Two of the parameters that are used to limit the time frame of the output are --since= and --until=. These parameters take a date and time value in the format of “YYYY-MM-DD hh:mm:ss” or a relative value such as “-1h” for one hour ago. For example, the command journalctl --since="2023-11-22 23:00:00" --until="2023-11-23 00:00:00" will show the logs from 11:00 PM to 12:00 AM on November 22, 2023. The --since= and --until= parameters are part of the LPI’s multi-level Linux professional certification program, and they are covered in the topic 106.1 System logging of the exam 102 objectives1. References: 1: https://www.lpi.org/our-certifications/exam-102-objectives/
When the command echo $$ outputs 12942, what is the meaning of 12942?
It is the process ID of the echo command.
It is the process ID of the current shell.
It is the process ID of the last command executed.
It is the process ID of the last command which has been placed in the background.
In bash, the PID of a shell script’s subshell process is stored in a special variable called $$. This variable is read-only, and you cannot modify it in a shell script1. You can use echo $$ to get the PID of the current bash shell you are using2. Therefore, when the command echo $$ outputs 12942, it means that the PID of the current shell is 12942. References:
[LPI Linux Essentials - Topic 103: Command Line Basics]
[Bash Special Parameters]
How to get the process ID (PID) of a shell script
How to know the process id of current bash session?
Which command allows you to make a shell variable visible to subshells?
export $VARIABLE
export VARIABLE
set $VARIABLE
set VARIABLE
env VARIABLE
The command that allows you to make a shell variable visible to subshells is export VARIABLE. This command turns the variable into a global or environment variable, which means it can be accessed by any child process or subshell that inherits the environment of the parent shell. The syntax of the export command does not require a dollar sign ($) before the variable name, unlike when referencing the value of the variable. The other commands are either invalid or do not affect the visibility of the variable to subshells. The set command can be used to assign values to variables, but it does not export them. The env command can be used to run a command in a modified environment, but it does not change the environment of the current shell. References:
[LPI Linux Essentials - Topic 105: Shells, Scripting and Data Management]
[LPI Linux Professional - Exam 102 Objectives - Topic 105: Shells and Shell Scripting]
What is a Subshell? - Linux Bash Shell Scripting Tutorial Wiki - nixCraft
What is Subshell in Linux? [Explained]
What keyword is missing from this code sample of a shell script?
____ i in *.txt; do
echo $i
done
for
loop
until
while
The set command is used to display or modify the shell variables and functions in the current shell. When used without any arguments, it prints the names and values of all shell variables, including environment variables and user-defined variables, in alphabetical order. The output also includes the shell options and the positional parameters. The set command can be used in any POSIX-compliant shell, such as bash, zsh, ksh, etc123.
The other options are not correct because:
env is used to print or modify the environment variables, not the shell variables. It does not show the user-defined variables or the shell options. It can also be used to run a command in a modified environment45.
env -a is an invalid option for the env command. The -a option is not supported by the env command in any standard or common implementation45.
echo $ENV is used to print the value of the environment variable ENV, not the list of all shell variables. The ENV variable is usually set to the name of a file that contains commands or aliases to be executed by the shell. It is mainly used by the ksh and some versions of bash .
References: 1: How can I list all shell variables? - Unix & Linux Stack Exchange 2: 2.1 Command Line Basics - Linux Professional Institute Certification … 3: set - The Open Group Base Specifications Issue 7, 2018 edition 4: How to set and list environment variables on Linux 5: env - The Open Group Base Specifications Issue 7, 2018 edition : What is the difference between .bash_profile and .bashrc? - Unix & Linux Stack Exchange : ENV - The Open Group Base Specifications Issue 7, 2018 edition
Which of the following are requirements in order to run a shell script like a regular command from anywhere in the filesystem? (Choose THREE correct answers.)
The user issuing the command must be in the group script.
The script file must be found in the $PATH.
The script file must have the executable permission bit set.
The script must begin with a shebang-line (#!) that points to the correct interpreter.
The file system on which the script resides must be mounted with the option scripts.
In order to run a shell script like a regular command from anywhere in the filesystem, the following requirements must be met:
The script file must be found in the $PATH. The $PATH is a variable that contains a list of directories where the shell looks for executable files when a command is issued. If the script file is not in one of these directories, the shell will not be able to find it unless the full path is specified.
The script file must have the executable permission bit set. This is a file attribute that determines whether the file can be executed by the user, the group, or others. The executable permission bit can be set using the chmod command, for example: chmod +x script.sh.
The script must begin with a shebang-line (#!) that points to the correct interpreter. This is a special line at the beginning of the script that tells the shell which program to use to run the script, such as #!/bin/bash for bash scripts, or #!/usr/bin/perl for perl scripts. The shebang-line must match the exact path of the interpreter, otherwise the script will not run.
The other options are not requirements for running a shell script like a regular command. There is no such group as script, and the file system mount option scripts does not exist. References:
[LPI Linux Essentials - Topic 105: Shells, Scripting and Data Management]
[LPI Linux Professional - Exam 102 Objectives - Topic 105: Shells and Shell Scripting]
What word is missing from the following SQL statement?
__________ count(*) from tablename;
(Please specify the missing word using lower-case letters only.)
select
The missing word is select, which is the keyword used to query data from a table in SQL. The select statement has the following syntax:
select column_list from table_name where condition;
The column_list can be one or more columns separated by commas, or an asterisk () to indicate all columns. The table_name is the name of the table that contains the data. The where clause is optional and specifies a condition to filter the rows. The count() function is an aggregate function that returns the number of rows in the table or in a group. Therefore, the complete statement is:
select count(*) from tablename;
This statement will return the number of rows in the table named tablename. References: SQL COUNT() Function - W3Schools, SQL COUNT: The Ultimate Guide To SQL COUNT Function - SQL Tutorial, The SQL Count Function Explained With 7 Examples.
What benefit does an alias in bash provide?
It provides faster lookups for commands in the system directory.
It creates a local copy of a file from another directory.
It hides what command you are running from others.
It allows a string to be substituted for the first word of a simple command.
An alias in bash provides the benefit of allowing a string to be substituted for the first word of a simple command. This means that you can create a shortcut or alternative name for a command that is already installed on your system, and use the new name to run the command instead of the original name. For example, you can create an alias for the ls -la command, which lists all files and directories in the current directory with detailed information, by running the following command:
alias ll='ls -la'
After defining the alias, you can use the ll command to execute the ls -la command. The alias will be active for the duration of the current shell session, unless you make it persistent by adding it to your shell startup file (such as ~/.bashrc for the Bash shell).
The other options are incorrect for the following reasons:
A: An alias does not provide faster lookups for commands in the system directory. The system directory is where the executable files for the commands are stored, and the shell uses the PATH variable to search for them. An alias does not affect the PATH variable or the system directory.
B: An alias does not create a local copy of a file from another directory. An alias is a way to rename a command, not a file. To create a local copy of a file, you can use the cp command.
C: An alias does not hide what command you are running from others. An alias is a way to simplify the use of a command, not to conceal it. Anyone can see what command an alias represents by using the type command or the alias command without any arguments.
References:
LPI E - alias
105.1 Lesson 1 - Linux Professional Institute Certification Programs
How to Create Bash Aliases | Linuxize
How to create a permanent Bash alias on Linux/Unix - nixCraft
bash - How do create an alias in shell scripts? - Stack Overflow
How can the existing environment variable FOOBAR be suppressed for the execution of the script./myscript only?
unset -v FOOBAR;./myscript
set -a FOOBAR="";./myscript
env -u FOOBAR./myscript
env -i FOOBAR./myscript
The env command can be used to run a utility or command in a custom environment without having to modify the currently existing environment1. The -u or --unset option can be used to remove a variable from the environment12. Therefore, the command env -u FOOBAR./myscript will run the script./myscript in an environment where the variable FOOBAR is suppressed. The other options are incorrect for the following reasons:
A. unset -v FOOBAR;./myscript: This will unset the variable FOOBAR in the current shell, not just for the script execution. The semicolon (;) separates two commands, so the script will run in the same environment as the unset command.
B. set -a FOOBAR=“”;./myscript: This will set the variable FOOBAR to an empty string, not suppress it. The -a option means that the variable will be exported to the environment of subsequent commands, so the script will still see the variable FOOBAR, but with no value.
D. env -i FOOBAR./myscript: This will run the script in an empty environment, not just suppress the variable FOOBAR. The -i or --ignore-environment option means that no environment variables will be passed to the command12. References: env command in Linux with Examples - GeeksforGeeks, env - Wikipedia.
Which of the following words is used to restrict the records that are returned from a SELECT SQL query based on a supplied criteria for the values in the records?
CASE
FROM
WHERE
IF
The SQL WHERE clause is used to restrict the records that are returned from a SELECT SQL query based on a supplied criteria for the values in the records12. The WHERE clause follows the SELECT and FROM clauses and contains one or more conditions that must be true for a record to be included in the result set. The general syntax of the WHERE clause is:
SELECT column1, column2, ...
FROM table_name
WHERE condition;
The condition can be a comparison, a logical operation, a pattern matching, a subquery, or a combination of these using various operators12. For example, the following query selects all the records from the customers table where the country is ‘USA’:
SELECT * FROM customers
WHERE country = 'USA';
The other words listed in the question are not used to filter records based on values. They have different meanings and purposes in SQL:
CASE: This is a conditional expression that returns a value based on a set of conditions3. It can be used in SELECT, UPDATE, DELETE, or WHERE statements. For example, the following query uses a CASE expression to assign a rating to each customer based on their credit limit:
SELECT customer_name, credit_limit, CASE WHEN credit_limit > 10000 THEN ‘High’ WHEN credit_limit > 5000 THEN ‘Medium’ ELSE ‘Low’ END AS rating FROM customers;
FROM: This is a clause that specifies the table (s) or view (s) from which the data is retrieved. It follows the SELECT clause and precedes the WHERE clause. For example, the following query selects the customer name and order date from the customers and orders tables:
SELECT customer_name, order_date FROM customers JOIN orders ON customers.customer_id = orders.customer_id;
IF: This is a control flow statement that executes a block of code based on a condition. It can be used in stored procedures, functions, triggers, or batch files. For example, the following code snippet uses an IF statement to check if a variable is positive or negative:
DECLARE @num INT; SET @num = -10; IF @num > 0 BEGIN PRINT ‘Positive’; END ELSE BEGIN PRINT ‘Negative’; END
References: 1: SQL WHERE Clause - W3Schools 2: How to Write a WHERE Clause in SQL | LearnSQL.com 3: [SQL CASE Statement - W3Schools] : [SQL FROM Clause - W3Schools] : [SQL IF…ELSE Statement - W3Schools]
What is the difference between the commands test -e path and test -f path?
They are equivalent options with the same behaviour.
The -f option tests for a regular file. The -e option tests for an empty file.
Both options check the existence of the path. The -f option also confirms that it is a regular file.
The -f option tests for a regular file. The -e option tests for an executable file.
The test command is used to perform checks and comparisons on files and values. The -e option tests if a given path exists, regardless of its type (file, directory, link, etc.). The -f option tests if a given path exists and is a regular file, not a directory or a special file. For example, if we have a directory named dir and a file named file, we can use the test command as follows:
test -e dir && echo “dir exists” dir exists test -f dir && echo “dir is a regular file” (no output) test -e file && echo “file exists” file exists test -f file && echo “file is a regular file” file is a regular file
References: https://www.howtoforge.com/linux-test-command/
https://www.computerhope.com/unix/bash/test.htm
Which of the following SQL statements will select the fields name and address from the contacts table?
SELECT (name, address) FROM contacts;
SELECT (name address) FROM contacts;
SELECT name, address FROM contacts;
SELECT name address FROM contacts;
The correct syntax for selecting specific columns from a table in SQL is to use the SELECT keyword followed by a comma-separated list of column names and then the FROM keyword followed by the table name. Therefore, the only option that follows this syntax is C. SELECT name, address FROM contacts; The other options are incorrect because they either use parentheses around the column names, which are not needed, or they omit the comma between the column names, which causes a syntax error. References: https://www.sqltutorial.org/sql-select/
https://www.w3schools.com/mysql/mysql_select.asp
When the command echo $ outputs 1, which of the following statements is true?
It is the process ID of the echo command.
It is the process ID of the current shell.
It is the exit value of the command executed immediately before echo.
It is the exit value of the echo command.
The $? variable in bash is a special parameter that holds the exit status of the last command executed in the current shell. The exit status is a numerical value that indicates whether the command was successful (zero) or failed (non-zero). The echo command simply prints its arguments to the standard output. Therefore, when the command echo $? outputs 1, it means that the previous command failed with an exit status of 1. References:
[LPI Linux Essentials - Topic 103: Command Line Basics]
[Bash Special Parameters]
[Exit status - Wikipedia]
Which of the following files, when existing, affect the behavior of the Bash shell? (Choose TWO correct answers.)
~/.bashconf
~/.bashrc
~/.bashdefaults
~/.bash_etc
~/.bash_profile
The Bash shell can be configured by various files that affect its behavior, such as setting environment variables, aliases, functions, options, and prompts. Some of these files are global, meaning they apply to all users of the system, and some are local, meaning they apply to individual users. The global files are usually located in the /etc directory, while the local files are usually located in the user’s home directory, which is denoted by the tilde (~) symbol1.
The local files that affect the Bash shell are:
~/.bash_profile: This file is executed when a user logs in to the system. It is used to set up the user’s environment, such as the PATH, the default editor, the umask, and other variables. It can also run commands that are needed only once per login session, such as ssh-agent or fortune. This file can also source other files, such as ~/.bashrc, to inherit their settings12.
~/.bashrc: This file is executed when a user starts a new interactive shell, such as opening a terminal window or running a script with the shebang #!/bin/bash. It is used to set up the user’s shell preferences, such as aliases, functions, options, and prompts. It can also source other files, such as /etc/bashrc, to inherit their settings12.
~/.bash_logout: This file is executed when a user logs out of the system. It is used to perform any cleanup tasks, such as clearing the screen, deleting temporary files, or printing a farewell message1.
The other files listed in the question are not valid Bash configuration files and do not affect the behavior of the shell. Therefore, the correct answer is B. ~/.bashrc and E. ~/.bash_profile.
References: 1: Bash Shell Configuration Files - Land of Linux 2: Bash Startup Files - GNU Project
On a Linux system with shadow passwords enabled, which file in the file system contains the password hashes of all local users? (Specify the full name of the file, including path.)
/etc/shadow
On a Linux system with shadow passwords enabled, the file that contains the password hashes of all local users is /etc/shadow. This file is a replacement for the password field in /etc/passwd, which is a world-readable file that contains basic information about users. The /etc/shadow file is not readable by regular users, and it stores the encrypted passwords (or hashes) of each user, along with other information such as password expiration dates, minimum and maximum password ages, and password warning periods. The /etc/shadow file has nine colon-delimited fields for each user:
Username: The name used when the user logs into the system.
Password: The encrypted password of the user, or a special character that indicates the password status. For example, an asterisk (*) means the account is locked, and an exclamation mark (!) means the password is expired.
Last Password Change: The date of the last password change, expressed as the number of days since January 1, 1970.
Minimum Password Age: The minimum number of days required between password changes. A zero means the password can be changed anytime.
Maximum Password Age: The maximum number of days the password is valid. After this number of days, the password must be changed. A zero means the password never expires.
Password Warning Period: The number of days before the password expires that the user will be warned. A zero means no warning is given.
Password Inactivity Period: The number of days after the password expires that the account will be disabled. A negative value means the account is never disabled.
Account Expiration Date: The date when the account will be disabled, expressed as the number of days since January 1, 1970. A zero means the account never expires.
Reserved Field: A field for future use.
The /etc/shadow file can be modified by using the commands passwd and chage, which are used to change the password and the password aging information of a user, respectively. The /etc/shadow file should not be edited directly, but always through the tools provided by the distribution. For more details, see the shadow manual page.
References:
LPIC-1 Exam 102 Objectives, Topic 110: Security, Subtopic 110.2: Use sudo to manage access to the root account, Weight: 2, Key Knowledge Areas: Configure sudo and sudoers. Use sudo to execute commands as another user.
LPIC-1 Exam 102 Learning Materials, Topic 110: Security, Subtopic 110.2: Use sudo to manage access to the root account, Section 110.2.1: sudo and sudoers, Page 3-5.
Which of the following commands shows all active systemd timers?
systemctl-timer show
timectl list
systemctl –t
systemctl list-timers
timeq
The command systemctl list-timers shows all active systemd timers, which are units that can be used to schedule the execution of other units at specific times or after certain intervals. The output of the command includes the following columns:
NEXT: The next time the timer will trigger.
LEFT: The time left until the next trigger.
LAST: The last time the timer triggered.
PASSED: The time passed since the last trigger.
UNIT: The name of the timer unit.
ACTIVATES: The name of the unit that is activated by the timer.
For example, the following output shows two active timers: apt-daily.timer and apt-daily-upgrade.timer, which are used to perform automatic updates on Debian-based systems.
NEXT LEFT LAST PASSED UNIT ACTIVATES Mon 2021-11-15 06:00:00 UTC 9h left Sun 2021-11-14 06:00:01 UTC 20h ago apt-daily.timer apt-daily.service Mon 2021-11-15 06:23:51 UTC 9h left Sun 2021-11-14 06:23:51 UTC 20h ago apt-daily-upgrade.timer apt-daily-upgrade.service 2 timers listed.
The other commands in the options are either invalid or unrelated to systemd timers:
systemctl-timer show is not a valid command. To show the details of a specific timer unit, the command systemctl show unit.timer can be used, where unit is the name of the unit that is activated by the timer.
timectl list is not a valid command. To list the available time zones, the command timedatectl list-timezones can be used. To list the current time and date settings, the command timedatectl can be used without any arguments.
systemctl -t is not a complete command. To list all units of a specific type, the command systemctl -t type can be used, where type is the name of the unit type, such as service, timer, socket, etc.
timeq is not a valid command. It may be confused with the time command, which measures the time taken by a command or program to execute.
References:
LPIC-1 Exam 102 Objectives, Topic 107: Administrative Tasks, Subtopic 107.2: Automate system administration tasks by scheduling jobs, Weight: 4, Key Knowledge Areas: Use cron and systemd timers to run jobs at regular intervals and to use anacron to manage system cron jobs. Objective: Use systemd timers to run jobs at regular intervals and to use anacron to manage system cron jobs.
LPIC-1 Exam 102 Learning Materials, Topic 107: Administrative Tasks, Subtopic 107.2: Automate system administration tasks by scheduling jobs, Section 107.2.3: systemd timers, Page 21-22.
Which command included in systemd supports selecting messages from the systemd journal by criteria such as time or unit name? (Specify only the command without any path or parameters.)
journalctl
The command journalctl is included in systemd and supports selecting messages from the systemd journal by criteria such as time or unit name. The systemd journal is a binary log file that stores system and service messages. The journalctl command can be used to view, filter, export, and manipulate the journal entries. For example, to show all messages from a specific unit, such as sshd.service, the command would be:
journalctl -u sshd.service
To show all messages from a specific time range, such as yesterday, the command would be:
journalctl --since=yesterday
The journalctl command has many options and arguments that can be used to customize the output and perform various operations on the journal. For more information, see the man page of journalctl or the official documentation1. References: [LPI 102-500 Exam Objectives], Topic 106.2: System logging, Weight: 3. [systemd-journald.service(8) — systemd — Debian unstable — Debian Manpages], Section NAME.
On a machine running serval X servers. how do programs identify the different instances of theX11 server?
By a fixed UUID that is defined in the X11 configuration file.
By a display name like :1.
By the name of the user that turns the X server like x11: bob.
By a device name like /dov/x11/xeorvore/1.
By a unique IPv6 address from the fc80: /64 subnet.
On a machine running several X servers, programs identify the different instances of the X11 server by a display name like :1. The display name consists of three parts: the hostname, the display number, and the screen number. The hostname is the name of the machine where the X server runs. The display number is a unique identifier that distinguishes different X server instances on the same machine. The screen number is used to address different physical screens that are managed by the same X server instance. The display name has the format hostname:displaynumber.screennumber. If the hostname is omitted, it means the local machine. The screen number is also optional and defaults to 0. For example, :1 means the second X server instance on the local machine, screen 0. remote:0.1 means the first X server instance on the remote machine, screen 1. The display name is part of the topic 106.1: Install and configure X11, which is one of the objectives of the LPI Linux Administrator - 102 exam12. References: 1: LPI Linux Administrator - 102 (LPIC-1) 2: Exam 102 Objectives
Which environment variable is used by an X11 client to determine the X Server to connect to? (Specify ONLY the variable name without any preceding commands or values.)
Display
What is true about the Hop Limit field in the IPv6 header?
The field is not changed during the transport of a package.
The field is transmitted within a hop-by-hop extension header.
Each router forwarding the packet increases the field’s value.
Each router forwarding the packet decreases the field’s value.
For multicast packages, the field’s value is always 1.
The Hop Limit field in the IPv6 header is similar to the Time to Live (TTL) field in the IPv4 header. It specifies the maximum number of hops (routers) that a packet can traverse before reaching its destination. Each router that receives the packet decrements the Hop Limit field by one and forwards the packet. If the Hop Limit field reaches zero, the packet is discarded and an ICMPv6 error message is sent back to the source. This mechanism prevents packets from looping indefinitely in the network12 References: 1: IPv6 packet - Wikipedia 2: IP Time to Live (TTL) and Hop Limit Basics - Packet Pushers
What is the purpose of TCP wrapper?
Manage and adjust bandwidth used by TCP services.
Bind a network service to a TCP port.
Encapsulate TCP messages in IP packets.
Add SSL support to plain text TCP services.
Limit access to a network service.
TCP wrapper is a security tool that allows you to restrict the access to a network service based on the source IP address or hostname of the client. TCP wrapper works by intercepting the incoming connection requests to a service and checking them against a set of rules defined in the /etc/hosts.allow and /etc/hosts.deny files. If the client is allowed, the connection is passed to the service. If the client is denied, the connection is rejected and an error message is logged. References:
LPI Linux Essentials: 1.5 Security and File Permissions: 1.5.3 Network Security
LPIC-1: System Administrator: 102.5 Implement basic network security: 102.5.1 TCP Wrappers
Which mechanism does ggfe use to interact with the SSH agent?
Connecting to pod 2222 which is used by the system-wide SSH agent.
Using the fixed socket .BBh-ngant/ipe.
Creating an alias replacing anh with calls to ssh-agent.
Starting ssh-agent as a child process for each sir. invocation.
Evaluating environment variables such as SSH_AUTH_SOCK.
What is Irue regarding the statement beginning with #. that is found in the first line of a script? (Choose TWO correct answers.)
It prevents the script from being executed until the, is removed
It triggers the installation of the script's interpreter.
It specifies the path and the arguments of the interpreter used to run the script.
It defines the character encoding of the script.
It is a comment that is ignored by the script interpreter.
Which of the following changes may occur as a consequence of using the command ip? (Choose three.)
Network interfaces may become active or inactive.
New name servers may be added to the resolver configuration.
The system’s host name may change.
IP addresses may change.
The routing table may change.
The ip command is a versatile tool that can be used to configure and manage various aspects of the network interfaces, such as IP addresses, routes, tunnels, and more. Depending on the options and arguments used, the ip command can cause different changes to the network configuration. Some of the possible changes are:
Network interfaces may become active or inactive. The ip command can be used to bring up or down a network interface, which means to activate or deactivate its connection to the network. For example, the command ip link set eth0 up will bring up the interface eth0, while the command ip link set eth0 down will bring it down. This can affect the network connectivity and performance of the system.
IP addresses may change. The ip command can be used to assign or remove IP addresses to a network interface, which are the numerical identifiers that allow the system to communicate with other hosts in the network. For example, the command ip addr add 192.168.1.100/24 dev eth0 will assign the IP address 192.168.1.100 with a subnet mask of 255.255.255.0 to the interface eth0, while the command ip addr del 192.168.1.100/24 dev eth0 will remove it. This can affect the network reachability and routing of the system.
The routing table may change. The ip command can be used to add or delete routes to the routing table, which is a data structure that stores the information about how to reach different network destinations. For example, the command ip route add 10.0.0.0/8 via 192.168.1.1 dev eth0 will add a route to the network 10.0.0.0/8 through the gateway 192.168.1.1 using the interface eth0, while the command ip route del 10.0.0.0/8 via 192.168.1.1 dev eth0 will delete it. This can affect the network traffic and efficiency of the system.
The ip command does not affect the following settings:
New name servers may be added to the resolver configuration. The resolver configuration is a file that specifies the name servers that the system uses to resolve domain names to IP addresses. The resolver configuration file is usually /etc/resolv.conf, and it is not modified by the ip command. To add or remove name servers, the file has to be edited manually or by another tool, such as resolvconf or NetworkManager.
The system’s host name may change. The host name is a human-readable name that identifies the system in the network. The host name is usually stored in the file /etc/hostname, and it is not changed by the ip command. To change the host name, the file has to be edited manually or by another tool, such as hostnamectl or nmtui.
References:
LPIC-1 Exam 102 Objectives, Topic 109: Networking Fundamentals, Subtopic 109.2: Persistent network configuration, Weight: 2, Key Knowledge Areas: Query and modify the behavior of network interfaces. Objective: Use the ip command to configure and modify the behavior of network interfaces.
LPIC-1 Exam 102 Learning Materials, Topic 109: Networking Fundamentals, Subtopic 109.2: Persistent network configuration, Section 109.2.2: ip, Page 17-19.
Which of the following programs uses the hosts.allow file to perform its main task of checking for access control restrictions to system services?
tcpd
inetd
fingerd
mountd
xinetd
The tcpd program is a wrapper for network services that use the TCP protocol. It intercepts incoming connection requests and checks them against the rules specified in the /etc/hosts.allow and /etc/hosts.deny files. If the connection is allowed, tcpd executes the actual service program and passes the connection to it. If the connection is denied, tcpd logs the attempt and sends an error message to the client. The tcpd program can be used to enhance the security and control of network access to various services, such as SSH, FTP, Telnet, etc.
The other programs listed are not directly related to the hosts.allow file, although they may be affected by it if they are wrapped by tcpd. The inetd and xinetd programs are super-servers that listen for incoming connections and launch the appropriate service program. The fingerd program is a service that provides information about users on a remote system. The mountd program is a service that handles NFS mount requests from clients. References:
tcpd(8) - Linux man page
Control server access using hosts.allow and hosts.deny files
hosts.allow format and example on Linux
What command is used to add OpenSSH private keys to a running ssh-agen . instance? (Specify the command name only without any path.)
ssh-add
How is a display manager started?
It is started by a user using the command startx.
It is started like any other system service by the init system.
It is started by inetd when a remote hosts connects to the X11 port.
It is started automatically when a X11 user logs in to the system console.
A display manager is a program that provides a graphical login screen for users to access a graphical desktop environment. A display manager is usually started by the init system, which is the first process that runs when the system boots up. The init system is responsible for starting and stopping various system services, including the display manager. The init system can be configured to start a specific display manager by setting the default runlevel or target, or by editing the /etc/X11/default-display-manager file123.
The other options are not correct because:
A. It is started by a user using the command startx. This option is false because the startx command is used to start an X session without a display manager. The startx command launches an X server and runs the user’s .xinitrc or .xsession file, which contains the commands to start the desired desktop environment or window manager. The startx command does not invoke a display manager or a graphical login screen .
C. It is started by inetd when a remote hosts connects to the X11 port. This option is false because inetd is a daemon that listens for incoming network connections and launches the appropriate service for each connection. Inetd does not start a display manager, but it can be used to enable remote access to an X session using the XDMCP protocol. XDMCP stands for X Display Manager Control Protocol, and it allows a remote host to request a graphical login screen from a display manager running on another host. However, this is not the same as starting a display manager, and it requires the display manager to be already running on the host that provides the XDMCP service .
D. It is started automatically when a X11 user logs in to the system console. This option is false because a display manager is not started by a user login, but by the init system. A user login can trigger the start of an X session, but not a display manager. A display manager is independent of the user login, and it can run on multiple virtual consoles or display devices. A display manager can also allow multiple users to log in to different X sessions simultaneously123.
References: 1: LPI Linux Certification/Setup A Display Manager - Wikibooks 2: Working with Display Managers - LPIC-1 102 Linux certification - Linux … 3: How to Change the Default Display Manager in Ubuntu 20.04 : startx - ArchWiki : How to start GUI from command line? - Ask Ubuntu : inetd - Wikipedia : XDMCP - ArchWiki
What is the default name of the configuration file for the Xorg X11 server? (Specify the file name only without any path.)
xorg.conf
The default name of the configuration file for the Xorg X11 server is xorg.conf. This file is used to store initial setup for X, such as settings for video cards, monitors, input devices, and other options. The Xorg X11 server is a display server that uses a configuration file called xorg.conf and files ending in the suffix .conf for its initial setup1. The xorg.conf file is typically located in /etc/X11/xorg.conf, but its location may vary across operating system distributions2. The xorg.conf file is not mandatory, as the Xorg X11 server can automatically configure most hardware and settings. However, it can be created and edited manually if needed3. References:
Xorg - ArchWiki
xorg.conf - Wikipedia
How to Configure X11 in Linux: 10 Steps (with Pictures) - wikiHow
An administrator wants to determine the geometry of a particular window in X, so she issues the __________ -metric command and then clicks on the window.
/usr/bin/xwininfo, xwininfo
The xwininfo command is a utility for displaying information about windows in X. It can show various attributes of a window, such as its location, size, depth, border width, visual class, colormap, map state, and event masks. The -metric option specifies that all dimensions should be displayed in metric units (millimeters) rather than pixels. By issuing the xwininfo -metric command and then clicking on a window, the administrator can determine the geometry of that window, including the decorations, in millimeters. References:
xwininfo(1) — Arch manual pages
[command line -
What is the name of the simple graphical login manager that comes with a vanilla X11 installation? (Specify ONLY the command without any path or parameters.)
xdm
The name of the simple graphical login manager that comes with a vanilla X11 installation is xdm. XDM is the traditional graphical login manager for the X Window System, independent of any window manager or environment the user might choose. When it is run at system startup, it displays a graphical login prompt rather than the text-based login prompt at the console1. XDM is part of the xorg-x11-apps package, which provides the basic applications for the X Window System2. XDM is also one of the topics covered by the LPI Linux Professional - Exam 102 Objectives - Topic 111: Graphical Desktops3. References:
xorg-x11-apps - Linux Man Pages (1) - SysTutorials
LPI Linux Professional - Exam 102 Objectives - Topic 111: Graphical Desktops
GitHub - iwamatsu/slim: SLiM (Simple Login Manager) is a graphical login manager for X11
slim-fork download | SourceForge.net
Using the XDM Graphical Login Manager | FreeBSD 6 Unleashed - Flylib
Xorg - ArchWiki
How to remotely log in with full graphical desktop over X11 - Unix & Linux Stack Exchange
Why is the xhost program considered dangerous to use?
It makes it difficult to uniquely identify a computer on the network.
It allows easy access to your X server by other users.
It logs sensitive information to syslog.
It makes your computer share network resources without any authentication.
It is a graphical DNS tool with known exploits.
The xhost program is used to add and delete host names or user names to the list allowed to make connections to the X server1. In the case of hosts, this provides a rudimentary form of privacy control and security. It is only sufficient for a workstation (single user) environment, although it does limit the worst abuses1. However, if xhost is used to grant access to everyone, even if they aren’t on the list (i.e., access control is turned off), then any user on the network can connect to your X server and monitor your keystrokes, capture your screen, or run malicious programs2. This is why xhost is considered dangerous to use and should be avoided in favor of more secure methods, such as xauth or ssh23. References:
xhost linux command man page - commandlinux.com
Linux Xhost Command Help and Examples - Computer Hope
xhost(1) — Arch manual pages
What is the purpose of a screen reader?
It reads text displayed on the screen to blind or visually impaired people.
It reads the parameters of the attached monitors and creates an appropriate X11 configuration.
It displays lines and markers to help people use speed reading techniques.
It manages and displays files that contain e-books.
A screen reader is a form of assistive technology that renders text and image content as speech or braille output. Screen readers are essential to people who are blind, and are useful to people who are visually impaired, illiterate, or have a learning disability. Linux has several screen readers available, such as Orca, Speakup, and Emacspeak. These screen readers can help users interact with the graphical or console interface, read documents and web pages, and perform various tasks on the system. References:
Screen reader - Wikipedia
Orca Screen Reader - GNOME
Accessibility in Linux is good (but could be much better)
The X11 configuration file xorg.conf is grouped into sections. How is the content of the section SectionName associated with that section?
It is placed in curly brackets as in Section SectionName { ... }.
It is placed between a line containing Section "SectionName" and a line containing EndSection.
It is placed between the tags
It is placed after the row [SectionName].
It is placed after an initial unindented Section "SectionName" and must be indented by exactly one tab character.
The X11 configuration file xorg.conf is grouped into sections, and the content of the section SectionName is associated with that section by placing it between a line containing Section “SectionName” and a line containing EndSection. For example, the following is a section named ServerLayout that defines the layout of the X server:
Section “ServerLayout” Identifier “X.org Configured” Screen 0 “Screen0” 0 0 InputDevice “Mouse0” “CorePointer” InputDevice “Keyboard0” “CoreKeyboard” EndSection
The other options are incorrect for the following reasons:
A: Curly brackets are not used to delimit sections in xorg.conf. They are used to enclose values that are lists, such as Option “XkbLayout” “{us,fr}”.
C: Tags are not used to delimit sections in xorg.conf. They are used in XML files, which have a different syntax and structure than xorg.conf.
D: Rows are not used to delimit sections in xorg.conf. They are used to define key-value pairs within a section, such as Identifier “Screen0”.
E: Indentation is not required to delimit sections in xorg.conf. It is used to improve readability and clarity, but it does not affect the functionality of the file.
References:
xorg.conf - X Window System
Editing basics for the xorg.conf file - Linux.com
106.1 Lesson 1 - Linux Professional Institute Certification Programs
For accessibility assistance, which of the following programs is an on-screen keyboard?
xkb
atkb
GOK
xOSK
GOK stands for GNOME On-screen Keyboard, and it is a program that provides a virtual keyboard for users who have difficulty using a physical keyboard. GOK is designed to be accessible and customizable, and it supports different keyboard layouts, input methods, and modes. GOK can also generate mouse and gesture events, and it can be controlled by various input devices, such as switches, joysticks, or head trackers. GOK is part of the GNOME desktop environment, and it can be enabled from the Universal Access settings panel123.
The other options are not correct because:
A. xkb is not a program, but a component of the X Window System that handles keyboard configuration and mapping. XKB stands for X Keyboard Extension, and it allows users to define the behavior and appearance of their keyboards, such as the layout, the modifiers, the symbols, and the actions. XKB does not provide an on-screen keyboard, but it can be used by other programs that do45.
B. atkb is not a valid name for any known program or component related to on-screen keyboards. There is no such program or component in the LPI Linux certification program or in the common Linux distributions. The closest match is ATK, which stands for Accessibility Toolkit, and it is a library that provides a set of interfaces for accessibility support in GNOME applications. ATK does not provide an on-screen keyboard, but it can be used by GOK and other programs that do6 .
D. xOSK is a program that provides an on-screen keyboard, but it is not the one that is mentioned in the LPI Linux certification program or in the common Linux distributions. xOSK stands for X On-Screen Keyboard, and it is a simple and lightweight virtual keyboard that can be used with any X11 application. xOSK is not part of any desktop environment, and it has to be installed and launched manually. xOSK is not as accessible and customizable as GOK, and it does not support different input methods or modes .
References: 1: GOK - GNOME Wiki! 2: How to Set Up a Virtual On-Screen Keyboard in Linux 3: Working With On-Screen Keyboards - Oracle Help Center 4: X keyboard extension - Wikipedia 5: XKB Configuration Guide 6: Accessibility Toolkit - GNOME Developer : Accessibility - ArchWiki : xosk - X On-Screen Keyboard : How to use on-screen virtual keyboard on Linux - Xmodulo
On a system running the KDE Display Manager, when is the /etc/kde4/kdm/Xreset script automatically executed?
When KDM starts
When a user's X session exits
When KDM crashes
When X is restarted
When X crashes
The /etc/kde4/kdm/Xreset script is a script that runs as root after a user’s X session exits. It can be used to perform some cleanup tasks or other actions that need to be done when the user logs out of the graphical environment. For example, it can reassign the ownership of the console to root, or shut down the system if desired. The /etc/kde4/kdm/Xreset script is part of the KDE Display Manager (kdm), which is a graphical login manager for X. KDM can be configured to run this script by setting the Reset key in the [X-*-Core] section of the /etc/kde4/kdm/kdmrc configuration file. References:
kdm.options - configuration options for X display manager
kdm(1) — kdm — Debian jessie — Debian Manpages
debian - How to get system to shutdown when Xorg is quit? - Unix …
Which command can be used to investigate the properties for a particular window in X by clicking that window? (Specify ONLY the command without any path or parameters.)
/usr/bin/xwininfo, xwininfo
The command that can be used to investigate the properties for a particular window in X by clicking that window is xwininfo. xwininfo is a command-line tool that provides information about X windows. When executed, it opens a small window and waits for the user to select a window by clicking on it. Then, it displays various characteristics about the window in question, such as its geometry, position, size, depth, class, name, id, and more. xwininfo is part of the X Window System, which is a graphical user interface system for Unix-like operating systems. xwininfo can be useful for debugging, testing, or scripting purposes. References: https://bing.com/search?q=command+to+investigate+properties+of+a+window+in+X
https://www.exam-answer.com/linux-foundation-certified-system-administrator-lfcs-simulation-investigate-window-properties
Which of the following lines is an example of a correct setting for the DISPLAY environment variable?
hostname:displayname
hostname:displaynumber
hostname/displayname
hostname/displaynumber
hostname
The correct format for the DISPLAY environment variable is hostname:displaynumber.screennumber, where hostname is the name of the computer where the X server runs, displaynumber is a sequence number (usually 0) that identifies a display, and screennumber is the number of the screen within that display (usually 0). The screennumber can be omitted if it is 0. For example, localhost:0 or myhost:1.0 are valid values for the DISPLAY variable. The other options are either missing the colon, using the wrong separator, or not specifying the display number. References:
X11 - DISPLAY (environment variable) - Datacadamia
x11 - How can I specify a display? - Stack Overflow
What is the $DISPLAY environment variable? - Ask Ubuntu
Which of the following are tasks handled by a display manager like XDM or KDM? (Choose TWO correct answers.)
Start and prepare the desktop environment for the user.
Configure additional devices like new monitors or projectors when they are attached.
Handle the login of a user.
Lock the screen when the user was inactive for a configurable amount of time.
Create an X11 configuration file for the current graphic devices and monitors.
The tasks that are handled by a display manager like XDM or KDM are to start and prepare the desktop environment for the user and to handle the login of a user. A display manager is a software component that manages the graphical user interface of an operating system. It provides a login screen where the user can enter their credentials and choose their preferred desktop environment or window manager. After the user is authenticated, the display manager launches the selected desktop environment or window manager and sets up the graphical session. The display manager also handles the logout, shutdown, and reboot of the system.
The other options are incorrect because they are not tasks handled by a display manager:
B. Configure additional devices like new monitors or projectors when they are attached. This task is handled by the X server, which is the core component of the X Window System. The X server is responsible for communicating with the hardware devices, such as the keyboard, mouse, monitor, and graphics card. The X server can detect and configure new devices dynamically using tools like xrandr or xorg.conf.
D. Lock the screen when the user was inactive for a configurable amount of time. This task is handled by the screensaver program, which is a utility that runs in the background and activates when the user is idle for a certain period of time. The screensaver can display various animations or images on the screen, or it can blank the screen entirely. The screensaver can also lock the screen and require the user to enter their password to resume the session. The screensaver can be configured by the user using tools like xscreensaver or gnome-screensaver.
E. Create an X11 configuration file for the current graphic devices and monitors. This task is handled by the X server, which is the core component of the X Window System. The X server can create an X11 configuration file, which is a text file that contains the settings for the X server and the devices it communicates with. The X11 configuration file is usually located at /etc/X11/xorg.conf or /etc/X11/xorg.conf.d/. The X server can generate a default configuration file using the command Xorg -configure, or it can be edited manually by the user or the system administrator. References https://www.baeldung.com/linux/display-managers-explained
https://quizlet.com/185979426/lx0-104-flash-cards/
What is the lowest numbered unprivileged TCP port? (Specify the number in digits only.)
1024
The lowest numbered unprivileged TCP port is 1024. A port number is a 16-bit unsigned integer, thus ranging from 0 to 65535. The port numbers in the range from 0 to 1023 are the well-known ports or system ports. They are used by system processes that provide widely used types of network services. On Unix-like operating systems, a process must execute with superuser privileges to be able to bind a network socket to an IP address using one of the well-known ports. Therefore, the lowest numbered port that can be used by a normal user without root access is 1024, which is the first unprivileged port123 References:
1: How to bind to port number less than 1024 with non root access?
2: lowest numbered unprivileged TCP port - Bing
3: List of TCP and UDP port numbers - Wikipedia
4: Privileged Ports - World Wide Web Consortium (W3C)
5: What is the lowest TCP port number? – TeachersCollegesj
What is true regarding a default route?
The default route is always used first. When the default route is not available more specific routes are tried.
When a default route is set, all other routes are disabled until the default route is deleted.
The default route is only used if there is not a more specific route to a destination host or network.
Without a default route, no network communication even in directly attached networks is possible.
A default route is a special type of route that specifies where to send packets when there is no explicit route for the destination in the routing table. A default route is usually configured on a router or a gateway that connects to another network, such as the internet. A default route is often represented by the destination 0.0.0.0/0, which means any IP address.
A default route is not always used first. It is only used as a last resort, when there is no more specific route for the destination. For example, if a host wants to send a packet to 192.168.1.10, and the routing table contains the following entries:
Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
The host will use the first entry, which is more specific, and send the packet directly to 192.168.1.10 via eth0 interface. The second entry, which is the default route, will not be used in this case. However, if the host wants to send a packet to 8.8.8.8, which is not in the same network, the host will use the default route and send the packet to 192.168.1.1, which is the gateway to the internet.
Setting a default route does not disable other routes. It only adds an entry to the routing table that can be used when no other route matches the destination. Other routes are still valid and can be used if they are more specific.
Without a default route, network communication in directly attached networks is still possible, as long as there are routes for those networks in the routing table. However, network communication to other networks that are not directly connected will not be possible, unless there are specific routes for those networks in the routing table.
References:
How to Set the Default Gateway in Linux - How-To Geek
Linux setup default gateway with route command - nixCraft
How to set a default route permanently in Linux - Xmodulo
Which of the following is a valid IPv6 address?
2001:db8:3241::1
2001::db8:4581::1
2001:db8:0g41::1
2001%db8%9990%%1
2001.db8.819f..1
A valid IPv6 address is represented as a set of 16-bit hexadecimals separated by colons. The address is divided into eight groups, and each 16-bit group is represented by four hexadecimal numbers. A valid IPv6 address is in the form “x1:x2:x3:x4:x5:x6:x7:x8” where each xi is a hexadecimal string which may contain digits, lower-case English letter (‘a’ to ‘f’) and upper-case English letters (‘A’ to ‘F’). Leading zeros are allowed in xi. The longest sequence of consecutive all-zero fields is replaced with two colons (::).1
Option A is the only one that follows these rules. Option B has two consecutive colons twice, which is not allowed. Option C has an invalid hexadecimal character ‘g’. Option D uses percentage signs instead of colons, which is not a valid separator. Option E uses dots instead of colons, and has two consecutive dots, which are both invalid.
References: 1: IPv4 and IPv6 address formats - IBM
Which of the following keywords can be used in the file /etc/nsswitch.conf to specify a source for host name lookups? (Choose TWO correct answers.)
resolve
dns
remote
files
hosts
The keywords dns and files can be used in the /etc/nsswitch.conf file to specify a source for host name lookups. The keyword dns means that the system will use the Domain Name System (DNS) to resolve host names to IP addresses. The keyword files means that the system will use the local /etc/hosts file to resolve host names to IP addresses. The order of the keywords on the line determines the order in which the sources will be queried. For example, the following line in /etc/nsswitch.conf:
hosts: files dns
means that the system will first check the /etc/hosts file for a matching host name, and if not found, it will query the DNS servers configured in /etc/resolv.conf. The other keywords in the question are not valid for the hosts database. The keyword resolv is used for the services database, which contains network service names and port numbers. The keyword remote is not a standard keyword, but it may be used by some applications to implement their own name service providers. The keyword hosts is the name of the database itself, not a source for it. References:
[LPI Linux Administrator - Exam 102 Objectives - Topic 109: Networking Fundamentals]
nsswitch.conf(5) - Linux manual page
What is the /etc/nsswitch.conf file in Linux – TecAdmin
Which keyword must be listed in the hosts option of the Name Service Switch configuration file in order to make host lookups consult the /etc/hosts file?
files
The keyword files must be listed in the hosts option of the Name Service Switch configuration file in order to make host lookups consult the /etc/hosts file. The files service specifies that the local files, such as /etc/hosts, should be used as a source of information. The order of the services on the line determines the order in which those services will be queried, in turn, until a result is found. For example, if the hosts option is set to:
hosts: files dns
then the /etc/hosts file will be searched first, and if no match is found, the DNS server will be queried next. If the hosts option is set to:
hosts: dns files
then the DNS server will be queried first, and if no match is found, the /etc/hosts file will be searched next. References:
LPI 102-500 Exam Objectives, Topic 110: Network Fundamentals, Weight: 4, 110.3 Basic network troubleshooting
LPI 102-500 Study Guide, Chapter 10: Network Fundamentals, Section 10.3: Basic Network Troubleshooting, Page 125-126
nsswitch.conf: Name Service Switch configuration file
What of the following can be done by the command ifconfig? (Choose TWO correct answers.)
Set a network interface active or inactive.
Specify the kernel module to be used with a network interface.
Allow regular users to change the network configuration of a network interface.
Change the netmask used on a network interface.
Specify which network services are available on a network interface.
The command ifconfig can be used to set a network interface active or inactive by using the up or down options. For example, the following command will activate the eth0 interface:
sudo ifconfig eth0 up
The command ifconfig can also be used to change the netmask used on a network interface by specifying the netmask option followed by the desired netmask value. For example, the following command will change the netmask of the eth0 interface to 255.255.255.0:
sudo ifconfig eth0 netmask 255.255.255.0
The other options in the question are not possible with the ifconfig command. The command ifconfig cannot specify the kernel module to be used with a network interface. This is done by the modprobe command or the /etc/modules file. The command ifconfig cannot allow regular users to change the network configuration of a network interface. This is controlled by the sudoers file or the polkit framework. The command ifconfig cannot specify which network services are available on a network interface. This is done by the firewall rules or the /etc/services file. References:
[LPI Linux Administrator - Exam 102 Objectives - Topic 109: Networking Fundamentals]
Linux ifconfig Command | Linuxize
15 Useful “ifconfig” Commands to Configure Network in Linux - Tecmint
ifconfig command in Linux with Examples - GeeksforGeeks
Given the following routing table:
How would an outgoing packet to the destination 192.168.2.150 be handled?
It would be passed to the default router 192.168.178.1 on wlan0.
It would be directly transmitted on the device eth0.
It would be passed to the default router 255.255.255.0 on eth0.
It would be directly transmitted on the device wlan0.
It would be passed to the router 192.168.1.1 on eth0.
The routing table shows how the kernel will route packets to different destinations based on the destination IP address, the gateway, the netmask, the flags, the metric, and the interface. The kernel will try to find the most specific route that matches the destination IP address, which means the route with the longest netmask. If there are multiple routes with the same netmask, the kernel will use the route with the lowest metric. If there is no matching route, the kernel will use the default route, which is the route with the destination 0.0.0.0.
In this case, the destination IP address is 192.168.2.150, which belongs to the network 192.168.2.0/24. The routing table has a specific route for this network, which is the second entry. The gateway for this route is 0.0.0.0, which means that the packet will be directly transmitted on the interface eth0, without passing through any router. The netmask for this route is 255.255.255.0, which means that the network has 256 possible hosts. The flags for this route are U, which means that the route is up, and G, which means that the route is to a gateway. The metric for this route is 0, which means that it has the highest priority. Therefore, the kernel will use this route to handle the outgoing packet to the destination 192.168.2.150.
References:
How To Display Routing Table In Linux - RootUsers
route command in Linux with Examples - GeeksforGeeks
Understand the basics of Linux routing | TechRepublic
Which of the following keywords can be used in the file /etc/resolv.conf? (Choose TWO correct answers.)
substitute
nameserver
search
lookup
method
The file /etc/resolv.conf is the configuration file for the DNS resolver, which translates domain names to IP addresses by querying the DNS servers. The file supports several keywords that provide various types of resolver information. Two of the keywords that can be used in /etc/resolv.conf are:
nameserver: This keyword specifies the IP address of the DNS server that the resolver can query against. Up to three nameservers can be configured, and the resolver will try them in order until one responds or all fail.
search: This keyword specifies a list of search domains that the resolver will append to the domain name when performing a query. For example, if the search list is example.com example.net, and the resolver queries for host, it will try host.example.com and host.example.net in order. The search list can have up to six domains, with a maximum of 256 characters in total.
The other keywords in the question are not valid for /etc/resolv.conf. The file does not support any keywords for substitution, lookup, or method. However, there are other keywords that can be used, such as:
domain: This keyword specifies the local domain name of the system. It is mutually exclusive with the search keyword, and only one instance of either can be used.
options: This keyword specifies various options that modify the behavior of the resolver. For example, the option rotate can be used to rotate the nameservers in a round-robin fashion, instead of trying them in order. Multiple options can be specified, separated by spaces.
References:
3: The /etc/resolv.conf File | Baeldung on Linux
1: /etc/resolv.conf - QNX
4: Chapter 33. Manually configuring the /etc/resolv.conf file
Which of the following tools used for DNS debugging, reports not only the response from the name server but also details about the query?
dnsq
dig
hostname
dnslookup
zoneinfo
The tool that reports not only the response from the name server but also details about the query is dig. Dig stands for domain information groper and it is a command-line tool that can query DNS servers for various types of records. Dig can also provide additional information such as the query time, the server address, the query options, and the response code. Dig is a powerful and flexible tool that can be used for DNS troubleshooting and testing123 References:
1: How to use the dig command - Linux.com
2: dig(1) - Linux manual page - man7.org
3: Top 6 Tools for DNS Troubleshooting | Total Uptime®
Which command, depending on its options, can display the open network connections, the routing tables, as well as network interface statistics. (Specify ONLY the command without any path or parameters.)
netstat, /bin/netstat, ss, /usr/bin/ss
The netstat command, meaning network statistics, is a command-line utility in the Linux system to display network configuration and activity, including network connections, routing tables, interface statistics, masquerade connections, and multicast memberships1. The netstat command can display different types of network data depending on the command line option selected. Some of the common options are:
-a: This option displays active TCP connections, TCP connections with the listening state, as well as UDP ports that are being listened to.
-r: This option displays the routing table information, which is a list of rules that determine where the packets are sent.
-i: This option displays the network interface information, such as the name, MTU, RX-OK, TX-OK, etc.
-s: This option displays the network statistics by protocol, such as TCP, UDP, ICMP, IP, etc.
For example, to display the open network connections, one can run:
netstat -a
To display the routing table, one can run:
netstat -r
To display the network interface statistics, one can run:
netstat -i
To display the network statistics by protocol, one can run:
netstat -s
For more details and examples, please refer to the web search results1 or the question answering results2. References:
https://netref.soe.ucsc.edu/node/7
https://bing.com/search?q=command+to+display+network+connections%2c+routing+tables%2c+and+interface+statistics
Which of the following statements is valid in the file /etc/nsswitch.conf?
multi on
192.168.168.4 dns-server
hosts: files dns
include /etc/nsswitch.d/
The statement hosts: files dns is valid in the file /etc/nsswitch.conf. It means that the system will use the local /etc/hosts file and the Domain Name System (DNS) to resolve host names to IP addresses. The order of the sources on the line determines the order in which they will be queried. In this case, the system will first check the /etc/hosts file for a matching host name, and if not found, it will query the DNS servers configured in /etc/resolv.conf. The other statements in the question are not valid in the /etc/nsswitch.conf file. The statement multi on is not a valid keyword or source for any database. The statement 192.168.168.4 dns-server is not a valid syntax for specifying a source or an action. The statement include /etc/nsswitch.d/ is not a valid way to include another file or directory in the /etc/nsswitch.conf file. References:
[LPI Linux Administrator - Exam 102 Objectives - Topic 109: Networking Fundamentals]
nsswitch.conf(5) - Linux manual page
What is the /etc/nsswitch.conf file in Linux – TecAdmin
Which of the following programs can be used to determine the routing path to a given destination?
dig
netstat
ping
route
traceroute
The traceroute program can be used to determine the routing path to a given destination by sending packets with incrementing TTL values and recording the source of the ICMP time exceeded messages. This way, it can show the intermediate hops and the round-trip times for each packet. The other programs have different purposes: dig is used to query DNS servers, netstat is used to display network connections and statistics, ping is used to test the reachability of a host by sending ICMP echo requests and measuring the response time, and route is used to manipulate the routing table. References:
LPI 102-500 Exam Objectives, Topic 110: Network Fundamentals, Weight: 4, 110.3 Basic network troubleshooting
LPI 102-500 Study Guide, Chapter 10: Network Fundamentals, Section 10.3: Basic Network Troubleshooting, Page 125-126
Which character in the password field of /etc/passwd is used to indicate that the encrypted password is stored in /etc/shadow?
*
-
s
x
The password field of /etc/passwd is used to store the user’s encrypted password or a special character that indicates how the password is stored. In older Linux systems, the user’s encrypted password was stored in the /etc/passwd file. On most modern systems, this field is set to x, and the user password is stored in the /etc/shadow file12. The /etc/shadow file is more secure than the /etc/passwd file because it is readable only by the root user and not by regular users1. The other options are not valid characters for the password field of /etc/passwd. References:
Understanding the /etc/passwd File | Linuxize
Understanding the /etc/passwd File - GeeksforGeeks
Of the ways listed, which is the best method to temporarily suspend a user's ability to interactively login?
Use passwd -d username to give the user an empty password.
Use chage to expire the user account.
Change the user's password.
Add the command exit to the user's .login file.
The chage command can be used to change the expiration date of a user account. By setting the expiration date to a past date, the user account will be disabled and the user will not be able to login interactively. This is a temporary method, as the expiration date can be changed back to a future date or removed to re-enable the user account. The other options are either permanent, insecure, or ineffective. Option A is insecure, as it allows anyone to login as the user without a password. Option C is permanent, as it changes the user’s password without saving the original one. Option D is ineffective, as it only affects the user’s .login file, which is used by the csh and tcsh shells, and not by other shells such as bash or zsh. Therefore, option B is the best method to temporarily suspend a user’s ability to interactively login. References: https://linuxconfig.org/disabling-user-logins-to-linux-system
https://askubuntu.com/questions/282806/how-to-enable-or-disable-a-user
What command will display the group names and GIDs to which a user belongs? (Provide only the command name with or without path information)
id, /usr/bin/id
The id command will display the user ID (uid), the primary group ID (gid), and the supplementary groups (groups) of a user. The output will show the names and the numerical IDs of the groups. For example:
id linuxize
The command will show the user ID (uid), the user’s primary group (gid), and the user’s secondary groups (groups)
uid=1001(linuxize) gid=1001(linuxize) groups=1001(linuxize),27(sudo)
To print only the names instead of the numbers use the -n option.
id -nG linuxize
The command will show only the names of the groups
linuxize sudo
The id command is part of the GNU coreutils package and is available on all Linux systems. The full path of the command is /usr/bin/id. References:
id(1) - Linux manual page
How to List Groups in Linux | Linuxize
Of the ways listed, which is the best way to temporarily suspend a single user's ability to interactively login?
Add the user name to /etc/nologin.
Change the user's password.
Change the user name in /etc/passwd.
Use change to expire the user account.
Place the command logout in the user's profile.
The best way to temporarily suspend a single user’s ability to interactively login is to use the chage command to expire the user account. The chage command can modify the expiration date of a user account, which is stored in the /etc/shadow file. By setting the expiration date to a past date, the user account will be locked and the user will not be able to login. This method is temporary because the expiration date can be changed again to a future date or removed to unlock the user account. For example, to expire the user account linuxconfig, we can use the following command:
# chage -E 0 linuxconfig
This will set the expiration date to January 1, 1970, which is the epoch date. To check the expiration date of a user account, we can use the -l option:
# chage -l linuxconfig
Last password change : Aug 24, 2021
Password expires : never
Password inactive : never
Account expires : Jan 01, 1970
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7
To remove the expiration date of a user account, we can use the -E option with an empty argument:
# chage -E "" linuxconfig
The other options are either invalid or not recommended. Adding the user name to /etc/nologin will not work, because /etc/nologin is a file that contains a message to be displayed to users who try to login when the system is down for maintenance. Changing the user’s password is not a good idea, because it will affect the user’s authentication and may cause security issues. Changing the user name in /etc/passwd will also affect the user’s authentication and may cause inconsistencies with other files and services. Placing the command logout in the user’s profile will not prevent the user from logging in, but only log them out immediately after login, which is not very elegant or secure. References: 1: How to disable user login with Linux nologin - LinuxConfig.org 2: Disable a user’s login without disabling the account - Unix & Linux Stack Exchange 3: How to Block or Disable Normal User Logins in Linux? - GeeksforGeeks 4: How to Disable User Logins on Linux | Baeldung on Linux 5: How to Disable a User in Linux - Linux Nightly 6: How to deactivate or disable a user account in Ubuntu 20.04 LTS - Vitux 7: chage(1) - Linux manual page
Which of the following commands can be used to convert text files in one character encoding to another character encoding?
cat
convert
dd
iconv
utf2utf
The command that can be used to convert text files in one character encoding to another character encoding is:
iconv: this command can convert text files from one form of encoding to another, such as UTF-8, ISO-8859-1, ASCII, etc. To use this command, you need to specify the input encoding, the output encoding, and the file name. For example, to convert a file named input.txt from ISO-8859-1 to UTF-8, you can run:
iconv -f ISO-8859-1 -t UTF-8 input.txt
The output will be printed to the standard output, which can be redirected to another file or piped to another command. You can also use the -o option to specify the output file name. For example, to convert the same file and save the output to output.txt, you can run:
iconv -f ISO-8859-1 -t UTF-8 -o output.txt input.txt
To list all the supported encodings, you can use the -l option. For example, to see all the encodings that start with UTF, you can run:
iconv -l | grep UTF
The iconv command is part of the GNU libc package and is available on most Linux systems. The full path of the command is /usr/bin/iconv.
The other options are incorrect because:
cat: this command can concatenate and print files to the standard output, but it does not perform any encoding conversion. It can be used to display the contents of a text file, but it will not change the encoding of the file.
convert: this command can convert image files from one format to another, such as PNG, JPEG, GIF, etc. It is part of the ImageMagick suite of tools and is not related to text encoding conversion.
dd: this command can copy and convert data from one source to another, such as files, devices, or pipes. It can perform some conversions, such as changing the case of letters, swapping bytes, or converting between ASCII and EBCDIC, but it does not support common text encodings such as UTF-8 or ISO-8859-1.
utf2utf: this is not a valid command on Linux. There is no such tool that can convert between different UTF encodings.
References:
How to Convert Files to UTF-8 Encoding in Linux - Tecmint
Best way to convert text files between character sets? - Stack Overflow
how to change encoding of a text file without openning the file in shell program - Stack Overflow
HowTo: Check and Change File Encoding In Linux - ShellHacks
How to change character encoding of a text file on Linux - Xmodulo
Which of the following commands can remove a user from a group?
grouprm
groupmod
passwd
usergroups
usermod
The usermod command is a utility for modifying user accounts. One of its options is -G, which allows specifying a list of supplementary groups that the user is a member of. If the user is currently a member of a group that is not listed, the user will be removed from that group. For example, to remove the user alice from the group sales, one can use the command sudo usermod -G admin alice, assuming that alice is only a member of admin and sales groups. Alternatively, one can use the gpasswd command with the --delete option to remove a user from a specific group without affecting other groups. For example, to remove the user alice from the group sales, one can use the command sudo gpasswd --delete alice sales. The other commands in the options are not used for removing a user from a group. The grouprm command does not exist. The groupmod command is used for modifying group attributes, not membership. The passwd command is used for changing user passwords, not groups. The usergroups command is used for displaying the groups that a user belongs to, not modifying them. References:
usermod(8) - Linux man page
gpasswd(1) - Linux man page
How to Remove User From Group in Linux [Quick Tip]
Which command should be added to /etc/bash_profile to change the language of messages from an internationalised program to Portuguese (pt)? (Select TWO correct answers)
export LANGUAGE="pt"
export MESSAGE="pt"
export LANG="pt"
export LC_MESSAGES="pt"
export ALL_MESSAGES="pt"
The commands that should be added to /etc/bash_profile to change the language of messages from an internationalised program to Portuguese (pt) are:
export LANG=“pt”
export LC_MESSAGES=“pt”
The LANG and LC_MESSAGES environment variables are used to control the language of messages from an internationalised program. The LANG variable sets the default locale for all categories, such as collation, currency, date and time formats, etc. The LC_MESSAGES variable sets the locale for the language of messages, overriding the LANG variable for this category. Therefore, to change the language of messages to Portuguese, both variables should be set to “pt” in /etc/bash_profile, which is a script that is executed when a user logs in. This will affect the current user and any subsequent login sessions.
References:
Locale Environment Variables in Linux – Baeldung on Linux
Environment Variables - The Open Group
[LPI Linux Essentials - 1.4 Localization and Internationalization]
Which crontab entry could be used to set the system time at regular intervals?
1 0 * * * date $d $t $24
1 0 * * * ntpdate ntp1.digex.net
1 0 * * * date ntp1.digex.net
1 0 * * * runcron date ntp1.digex.net
1 0 * * * settime $d $t $24
The crontab entry that could be used to set the system time at regular intervals is the one that uses the ntpdate command to synchronize the system clock with a Network Time Protocol (NTP) server. The ntpdate command takes one or more NTP server names or IP addresses as arguments and adjusts the system clock accordingly12. The crontab entry B specifies that the ntpdate command should be executed at the first minute of the zeroth hour (i.e., 00:01) of every day of every month of every weekday, using the NTP server ntp1.digex.net34. This will ensure that the system time is updated daily with a reliable source.
The other crontab entries are either invalid or ineffective for setting the system time at regular intervals. The date command can be used to display or set the system date and time, but it requires a specific format for the argument, not an NTP server name5. The runcron and settime commands are not standard Linux commands and their functionality is unknown. The $d, $t, and $24 variables are also undefined and meaningless in this context.
References: 1: Linux At, Batch, Atq, Atrm Command Help and Examples - Computer Hope 2: How to set a cron job to run at a exact time? - Stack Overflow 3: 107.2 Lesson 1 - Linux Professional Institute Certification Programs 4: How to setup a crontab to execute at specific time - Stack Overflow 5: Writing a specific format of time in a text file every minute using … - Ask Ubuntu
Which of the following steps prevents a user from obtaining an interactive login session?
Run the command chsh -s /bin/false with the user name.
Set the UID for the user to 0.
Remove the user from the group staff.
Add the user to /etc/noaccess.
Create a .nologin file in the user's home directory.
Running the command chsh -s /bin/false with the user name will change the user’s login shell to /bin/false, which is a program that does nothing and returns a non-zero exit code. This means that the user will not be able to execute any commands or start an interactive shell session. This is a common way to disable a user’s login without disabling the account completely, which can be useful for users who only need to access the system via scp, sftp, or other non-interactive services. However, this method does not prevent the user from authenticating with the system, and it may not work with some services that do not rely on the login shell, such as ssh with a forced command. Therefore, it is not a foolproof way to secure the system from unauthorized access. References: 1234
Why is /etc/shadow not world readable if the passwords are stored in an encrypted fashion?
The encrypted passwords are still subject to brute force attacks.
This is just for historical reasons.
There is other information in the file that needs to be kept secret.
The passwords can be decrypted by anyone with root access.
The /etc/shadow file is not world readable because the encrypted passwords stored in it are still vulnerable to offline brute force attacks. A brute force attack is a method of trying every possible password until finding the correct one. With modern hardware and software, millions of passwords can be tried per second. If the /etc/shadow file was world readable, anyone who logged in to the system, even as a guest, could copy the file and attempt to crack the passwords without leaving any trace. By making the file readable only by the root user, the system prevents unauthorized access to the password hashes and reduces the risk of password compromise. The other options are incorrect because they do not explain the reason for the file permissions. Option B is false, as the /etc/shadow file was created to address the security issues of the /etc/passwd file, which used to store the passwords in a world readable file. Option C is partially true, as the /etc/shadow file does contain other information related to password expiration and account locking, but this is not the main reason for making the file not world readable. Option D is irrelevant, as the passwords cannot be decrypted by anyone, even with root access, as the encryption is one-way and irreversible. References: https://www.computernetworkingnotes.com/linux-tutorials/etc-shadow-file-in-linux-explained-with-examples.html
https://kerneltalks.com/user-management/understanding-etc-shadow-file/