LPIC-1 Exam 102, Part 2 of 2, version 5.0 Questions and Answers
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?
Options:
Answer:
files
Explanation:
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
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.)
Options:
Answer:
netstat, /bin/netstat, ss, /usr/bin/ss
Explanation:
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:
Which of the following tools used for DNS debugging, reports not only the response from the name server but also details about the query?
Options:
dnsq
dig
hostname
dnslookup
zoneinfo
Answer:
BExplanation:
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®
On a regular users workstation the route command takes a long time before printing out the routing table. Which of the following errors does that indicate?
Options:
The local routing information may be corrupted and must be re-validated using a routing protocol.
One of the routers in the routing table is not available which causes the automatic router failure detection mechanism (ARF-D) to wait for a timeout.
There may accidentally be more than one default router in which case a default router election has to be done on the network in order to choose one router as the default.
DNS resolution may not be working as route by default tries to resolve names of routers and destinations and may run into a timeout.
Answer:
DExplanation:
The route command displays the kernel’s routing table, which contains information about how packets are routed to different destinations. By default, route tries to resolve the IP addresses of the routers and destinations to their hostnames using DNS. If DNS is not working properly, this can cause a delay in displaying the routing table as route waits for the DNS queries to time out. To avoid this, route can be used with the -n option, which prevents DNS lookups and displays only numeric addresses. References:
LPI 102-500 Exam Objectives, Topic 109: Network Fundamentals, 109.3 Basic network troubleshooting
LPI 102-500 Study Guide, Chapter 9: Network Troubleshooting, Section 9.2: Troubleshooting Routing Problems
Which of the following keywords can be used in the file /etc/resolv.conf? (Choose TWO correct answers.)
Options:
substitute
nameserver
search
lookup
method
Answer:
B, CExplanation:
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 may occur as a consequence of using the command ifconfig? (Choose THREE correct answers.)
Options:
New name servers may be added to the resolver configuration.
Network interfaces may become active or inactive.
The routing table may change.
IP addresses may change.
The system's host name may change.
Answer:
B, C, DExplanation:
Network interfaces may become active or inactive, the routing table may change, and IP addresses may change. Comprehensive Explanation: The ifconfig command is a network management tool that is used to configure and view the status of the network interfaces in Linux operating systems1. With ifconfig, you can assign IP addresses, enable or disable interfaces, manage ARP cache, routes, and more1. Some of the possible consequences of using the ifconfig command are:
Network interfaces may become active or inactive. The ifconfig command can take an interface name as an argument and display the configuration information for that interface. For example, to view the configuration of the eth0 interface, one can run:
ifconfig eth0
The output shows whether the interface is UP or DOWN, meaning active or inactive. The ifconfig command can also activate or deactivate an interface by using the up or down options. For example, to deactivate the eth0 interface, one can run:
sudo ifconfig eth0 down
To activate the eth0 interface, one can run:
sudo ifconfig eth0 up
The routing table may change. The ifconfig command can assign IP addresses, netmask, and broadcast address to a network interface. For example, to assign an IP address of 192.168.1.10, a netmask of 255.255.255.0, and a broadcast address of 192.168.1.255 to the eth0 interface, one can run:
sudo ifconfig eth0 192.168.1.10 netmask 255.255.255.0 broadcast 192.168.1.255
These parameters affect the routing table, which is a list of rules that determine where the packets are sent. The routing table can be viewed by using the route command. For example, to view the routing table, one can run:
route -n
The output shows the destination, gateway, netmask, flags, metric, reference, use, and interface for each route. The ifconfig command can also delete an IP address from an interface, which may remove the corresponding route from the routing table. For example, to delete the IP address of 192.168.1.10 from the eth0 interface, one can run:
sudo ifconfig eth0 0
IP addresses may change. The ifconfig command can assign or delete IP addresses to a network interface, as explained above. The IP address is a unique identifier that allows the network interface to communicate with other devices on the network. The IP address can be viewed by using the ifconfig command without any options or with the interface name only. For example, to view the IP address of the eth0 interface, one can run:
ifconfig eth0
The output shows the inet addr, which is the IP address of the interface. The ifconfig command can also create an alias for the network interface, which is a virtual interface that shares the same physical interface but has a different IP address. For example, to create an alias for the eth0 interface with an IP address of 192.168.1.11, one can run:
sudo ifconfig eth0:0 192.168.1.11
The alias can be viewed by using the ifconfig command with the alias name. For example, to view the configuration of the eth0:0 alias, one can run:
ifconfig eth0:0
The output shows the inet addr, which is the IP address of the alias.
The other options are not correct because:
New name servers may be added to the resolver configuration. The ifconfig command does not affect the resolver configuration, which is a file that contains the names and addresses of the name servers that resolve domain names to IP addresses. The resolver configuration is stored in the /etc/resolv.conf file and can be viewed or edited by using a text editor. For example, to view the resolver configuration, one can run:
cat /etc/resolv.conf
The output shows the nameserver entries, which are the IP addresses of the name servers. The ifconfig command does not add or remove name servers from this file.
The system’s host name may change. The ifconfig command does not affect the host name, which is a name that identifies the system on the network. The host name is stored in the /etc/hostname file and can be viewed or edited by using a text editor. For example, to view the host name, one can run:
cat /etc/hostname
The output shows the host name of the system. The ifconfig command does not change the host name of the system. References:
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.)
Options:
resolve
dns
remote
files
hosts
Answer:
B, DExplanation:
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 of the following IPv4 networks are reserved by IANA for private address assignment and private routing? (Choose THREE correct answers.)
Options:
127.0.0.0/8
10.0.0.0/8
169.255.0.0/16
172.16.0.0/12
192.168.0.0/16
Answer:
B, D, EExplanation:
According to the RFC 19181, the Internet Assigned Numbers Authority (IANA) has reserved the following three blocks of the IPv4 address space for private internets:
10.0.0.0 - 10.255.255.255 (10/8 prefix)
172.16.0.0 - 172.31.255.255 (172.16/12 prefix)
192.168.0.0 - 192.168.255.255 (192.168/16 prefix)
These address blocks are not globally routable and are intended for use within private networks, such as home, office, or campus networks. They can be assigned to any device that does not need to communicate directly with the public internet, or that can use network address translation (NAT) to do so. Private addresses allow for more efficient use of the limited IPv4 address space and reduce the need for public addresses.
The other options are not reserved for private use by IANA. Option A, 127.0.0.0/8, is reserved for loopback addresses, which are used to refer to the local host. Option C, 169.255.0.0/16, is a typo and should be 169.254.0.0/16, which is reserved for link-local addresses, which are used for automatic address configuration on a local network segment. Option F, 224.0.0.0/4, is reserved for multicast addresses, which are used for one-to-many communication.
References:
RFC 1918: Address Allocation for Private Internets - RFC Editor
IANA IPv4 Special-Purpose Address Registry
Private network - Wikipedia
Which of the following is a valid IPv6 address?
Options:
2001:db8:3241::1
2001::db8:4581::1
2001:db8:0g41::1
2001%db8%9990%%1
2001.db8.819f..1
Answer:
AExplanation:
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
What is the purpose of the nsswitch.conf file?
Options:
It is used to configure where the C library looks for system information such as host names and user passwords.
It is used to configure network protocol port numbers such as for HTTP or SMTP.
It is used to configure LDAP authentication services for the local system.
It is used to configure which network services will be turned on during the next system boot.
Answer:
AExplanation:
The nsswitch.conf file is a configuration file that determines the sources and the order of the sources that are queried for various system databases, such as user information, group information, host names, network services, and more. The C library uses this file to look up various system information when a program or a command requests it. For example, when a user logs in, the C library will use the nsswitch.conf file to determine where to find the user’s password, whether it is in the local /etc/passwd file, or in a remote LDAP server, or both. The nsswitch.conf file allows the system administrator to configure the system databases in a flexible and modular way. References:
[LPI Linux Essentials - Topic 106: The Linux Operating System]
[LPI Linux Administrator - Exam 102 Objectives - Topic 110: Security]
[Linux man page for nsswitch.conf]
Which port is the default server port for the HTTPS protocol? (Specify the port number using digits.)
Options:
Answer:
443
Explanation:
The port number 443 is the default server port for the HTTPS protocol, which is a secure version of HTTP that uses SSL/TLS certificates to encrypt the data transmission between web servers and browsers. The port number 443 is recognized by the Internet Engineering Task Force (IETF) as the standard port for HTTPS connections1. The port number 443 is part of the topic 109.1: Fundamentals of internet protocols, which is one of the objectives of the LPI Linux Administrator - 102 exam23. References: 1: HTTPS Port: What It Is, How to Use It, and More (2023) - Hostinger 2: LPI Linux Administrator - 102 (LPIC-1) 3: Exam 102 Objectives
Which of the following commands can be used to display the local routing table? (Choose TWO correct answers.)
Options:
ifconfig
dig
netstat
route
trackroute
Answer:
C, DExplanation:
The commands that can be used to display the local routing table are netstat and route. Both commands can show the kernel routing tables, which contain information about the network destinations and the gateways to reach them. The netstat command can be used with the -r option to display the routing table, and the -n option to show numeric addresses only. The route command can also be used with the -n option to display the routing table without resolving names. However, both netstat and route are considered obsolete and have been replaced by the ip route command, which is the current recommended way of printing the routing table in Linux12. References:
1: Understanding Routing Table - nixCraft
2: How To Display Routing Table In Linux - RootUsers
3: linux networking - What is the local routing table used for? - Server Fault
What command is used to add OpenSSH private keys to a running ssh-agen . instance? (Specify the command name only without any path.)
Options:
Answer:
ssh-add
Which standardized TCP port is used by HTTPS services?
Options:
25
80
8080
443
636
Answer:
DWhich option in the chrony configuration file changes the initial interval of polls to a NTP server in order to speed up the initial synchronization?
Options:
iburst
quickstart
fast
D. fsync
flood
Answer:
AExplanation:
The option in the chrony configuration file that changes the initial interval of polls to a NTP server in order to speed up the initial synchronization is iburst. The iburst option allows chronyd to send four requests to the server at intervals of 2 seconds or less, instead of the interval specified by the minpoll option, which is usually 64 seconds. This way, chronyd can make the first update of the clock shortly after start1. The iburst option is recommended for all servers, especially if the network connectivity is not reliable1.
The other options are not valid or do not have the same effect as iburst. The quickstart option does not exist in the chrony configuration file. The fast option is used to specify a fast initial correction of the system clock, but it does not change the polling interval1. The fsync option is used to enable or disable synchronization of the system clock to the real-time clock (RTC) every 11 minutes1. The flood option is used to enable a mode of operation where chronyd sends a burst of requests to the server at a high rate, which can be useful for testing or initial synchronization of a very inaccurate clock1.
References:
LPI Linux Essentials: 1.4. Using sudo
LPI Linux Administrator: 102.5. Use Debian package management
LPI Linux Engineer: 201.1. Measure and Troubleshoot Resource Usage
LPI Linux Professional Certification Program
1
Which of the following commands display the number of bytes transmitted and received via the etho network interface? (Choose TWO correct answer.)
Options:
Route –v via etho
Ip stats show dev etho
Netstat –s –I etho
Ifconfig etho
Ip –s link show etho
Answer:
D, EWhich of the following files is not read directly by a Bash login shell?
Options:
-/.bashrc
-/.bash_profile
-/.bash_login
-/.profile
/etc/profile
Answer:
AIn an xinetd configuration file, which attribute specifies the network address that will be used to provide the service?
Options:
Answer:
bind, interface
Explanation:
The bind attribute in an xinetd configuration file specifies the network address that will be used to provide the service. It can be either an IP address or a hostname. If the bind attribute is not specified, xinetd will listen on all available addresses on the system. The bind attribute can be used to restrict the service to a specific interface or network. For example, bind = 192.168.1.100 will only allow the service to be accessed from the 192.168.1.0/24 network. The bind attribute can also be used to provide different configurations for the same service on different addresses. For example, one can have two telnet configuration files, one with bind = 192.168.1.100 and another with bind = 192.168.2.100, to offer different access rules or options for the telnet service on each address.
References:
xinetd - Wikipedia
17.4. xinetd Configuration Files - Red Hat Customer Portal
How to configure xinetd ? - Red Hat Customer Portal
Which of the following features are provided by SPICE? (Choose two.)
Options:
Connecting local USB devices to remote applications.
Accessing graphical applications on a remote host.
Replacing Xorg as local X11 server.
Downloading and locally installing applications from a remote machine.
Uploading and running a binary program on a remote machine.
Answer:
A, BExplanation:
SPICE is a protocol that allows users to access graphical applications on a remote host, such as a virtual machine or a server, using a client program. SPICE also supports connecting local USB devices to remote applications, such as printers, scanners, or flash drives, using a feature called USB redirection. SPICE does not replace Xorg as the local X11 server, nor does it allow downloading and locally installing applications or uploading and running binary programs from a remote machine. These are features that are provided by other tools, such as SSH, SCP, or RDP. References:
Features - spice-space.org
SPICE - Wikipedia
SPICE Model <What is SPICE?> | Electronics Basics | ROHM
Depending on a system's configuration, which of the following files can be used to enable and disable network services running on this host?
Options:
/etc/profile
/etc/xinetd.conf
/etc/ports
/et/host.conf
/etc/host.conf
Answer:
BExplanation:
The file that can be used to enable and disable network services running on this host is /etc/xinetd.conf. This file is the main configuration file for the xinetd daemon, which is a super-server that can start other network services on demand. The /etc/xinetd.conf file contains global settings and a list of services that xinetd can manage. Each service has its own configuration section, which can include the disable keyword to enable or disable the service. For example, to disable the telnet service, the configuration section would look like this12:
service telnet
{
disable = yes
socket_type = stream
protocol = tcp
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
}
The other files are not related to network services. The /etc/profile file is a global configuration file for the Bash shell, which sets environment variables and aliases for all users3. The /etc/ports file does not exist by default in Linux, and it is not a standard file for network configuration. The /et/host.conf file is a typo, and it should be /etc/host.conf, which is a file that controls the behavior of the resolver library, which is used to look up host names and IP addresses4. The /etc/host.conf file is not used to enable or disable network services, but to specify the order of host name resolution methods5. References:
1: How to enable or disable services with xinetd - LinuxConfig.org
2: xinetd.conf(5) - Linux manual page - man7.org
3: What is /etc/profile file in Linux? - LinuxForDevices
4: host.conf(5) - Linux manual page - man7.org
5: Linux host.conf file - Computer Notes
Which of the following commands configure network interfaces based on the system’s existing distribution-specific configuration files? (Choose two.)
Options:
ifconf
ifdown
ifpause
ifstart
ifup
Answer:
B, EExplanation:
The commands ifdown and ifup are used to configure network interfaces based on the system’s existing distribution-specific configuration files. These files are typically located in /etc/network/interfaces or /etc/sysconfig/network-scripts, depending on the Linux distribution. The ifdown command shuts down a network interface, while the ifup command brings up a network interface. These commands can be used to apply changes made to the configuration files without rebooting the system12.
The other commands are not related to network interface configuration. The ifconf command does not exist in Linux. The ifpause and ifstart commands are not standard Linux commands, but they may be aliases or scripts defined by some users or distributions. References: 1: NetworkConfigurationCommandLine - Community Help Wiki. 2: [How to Configure Network Static IP Address on RHEL/CentOS 8/7/6].
Given the following excerpt of the sudo configuration:
jane ANY=NOPASSWD: /bin/kill, /bin/id, PASSWD: /sbin/fdisk
Which of the following statements are true? (Choose three.)
Options:
Jane can run /bin/id only after specifying her password.
Jane can run /sbin/fdisk after specifying root’s password.
Jane can run /sbin/fdisk after specifying her password.
Jane can run /bin/kill without specifying a password.
Jane can run /bin/id without specifying her password.
Answer:
C, D, EExplanation:
The sudo configuration file (/etc/sudoers) defines the rules for granting privileges to users or groups to execute commands as another user, usually the superuser or root. The format of the sudo configuration file is as follows:
user_list host_list=effective_user_list tag_list command_list
The user_list specifies the users who can run the commands, the host_list specifies the hosts where the commands can be run, the effective_user_list specifies the user as whom the commands can be run, the tag_list specifies some options for the commands, and the command_list specifies the commands that can be run.
In this case, the user_list is jane, the host_list is ANY (meaning any host), the effective_user_list is not specified (meaning root by default), the tag_list is NOPASSWD or PASSWD (meaning whether a password is required or not), and the command_list is /bin/kill, /bin/id, or /sbin/fdisk.
Therefore, the sudo configuration file allows jane to run /bin/kill, /bin/id, or /sbin/fdisk as root on any host, but with different password requirements. Specifically:
Jane can run /bin/kill without specifying a password, because the tag_list is NOPASSWD for this command. This means that jane can execute sudo /bin/kill and the command will run as root without asking for any password. This makes option D true.
Jane can run /bin/id without specifying a password, because the tag_list is also NOPASSWD for this command. This means that jane can execute sudo /bin/id and the command will run as root without asking for any password. This makes option E true.
Jane can run /sbin/fdisk after specifying her password, because the tag_list is PASSWD for this command. This means that jane can execute sudo /sbin/fdisk and the command will ask for jane’s password before running as root. This makes option C true.
The other options are false because:
Jane cannot run /bin/id only after specifying her password, because the tag_list is NOPASSWD for this command. This makes option A false.
Jane cannot run /sbin/fdisk after specifying root’s password, because the password that is required is jane’s password, not root’s password. This makes option B false.
References:
LPI Linux Essentials: 1.4. Using sudo
LPI Linux Administrator: 102.5. Use Debian package management
LPI Linux Engineer: 201.1. Measure and Troubleshoot Resource Usage
LPI Linux Professional Certification Program
Which of the following programs uses the hosts.allow file to perform its main task of checking for access control restrictions to system services?
Options:
tcpd
inetd
fingerd
mountd
xinetd
Answer:
AExplanation:
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
Which of the following nmcli subcommands exist? (Choose two.)
Options:
nmcli ethernet
nmcli device
nmcli wifi
nmcli address
nmcli connection
Answer:
B, EExplanation:
The nmcli command is a command-line interface for NetworkManager, which is a tool for configuring and managing network settings on Linux systems. The nmcli command consists of different subcommands that correspond to different aspects of network configuration and management. The subcommands are:
nmcli general: shows status and permissions of NetworkManager, as well as system hostname and logging level and domains.
nmcli connection: enables you to create, modify, activate, deactivate, delete, and show network connections.
nmcli device: enables you to show, modify, and control network devices, such as interfaces, bonds, teams, bridges, etc.
nmcli monitor: monitors activity of NetworkManager and watches for changes in the state of connectivity and devices.
nmcli networking: enables or disables overall networking.
nmcli radio: enables or disables radio transmitters for Wi-Fi, Bluetooth, and WWAN devices.
nmcli agent: registers as a secret agent that provides and caches network credentials.
The other options listed are not valid nmcli subcommands. There is no nmcli ethernet, nmcli wifi, or nmcli address subcommand. However, nmcli device and nmcli connection can be used to configure and manage Ethernet and Wi-Fi connections and addresses. References:
NetworkManager configuration and usage | SLE Micro 5.3
nmcli: NetworkManager Reference Manual - GNOME
nmcli: command not found – The Geek Diary
To prevent a specific user from scheduling tasks with at, what should the administrator do?
Options:
Add the specific user to /etc/at.allow file.
Add the specific user to [deny] section in the /etc/atd.conf file.
Add the specific user to /etc/at.deny file.
Add the specific user to nojobs group.
Run the following: atd --deny [user].
Answer:
CExplanation:
The /etc/at.deny file is a file that contains a list of users who are not allowed to use the at command to schedule jobs. If the file exists, any user who is not in the /etc/at.allow file and is in the /etc/at.deny file will be denied access to the at command. To prevent a specific user from scheduling tasks with at, the administrator can simply add the user’s name to the /etc/at.deny file. For example, to prevent the user bob from using the at command, the administrator can use the following command:
echo “bob” | sudo tee -a /etc/at.deny
The other options are not correct. The /etc/at.allow file is a file that contains a list of users who are allowed to use the at command. Adding a user to this file will not prevent them from scheduling tasks with at. The /etc/atd.conf file is a configuration file for the at daemon, which does not have a [deny] section. Adding a user to this file will not affect their access to the at command. The nojobs group is not a predefined group in Linux, and adding a user to this group will not prevent them from scheduling tasks with at. The atd command does not have a --deny option, and running this command will not prevent a user from scheduling tasks with at. References:
at Command in Linux with Examples - GeeksforGeeks
How to Use the Linux at Command {9 Examples} - phoenixNAP
at(1) - Linux man page
Of the ways listed, which is the best way to temporarily suspend a single user's ability to interactively login?
Options:
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.
Answer:
DExplanation:
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 steps prevents a user from obtaining an interactive login session?
Options:
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.
Answer:
AExplanation:
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
Which of the following can the chage command NOT change?
Options:
The number of days since January 1, 1970 after which the user's account will no longer be accessible.
The number of days since January 1, 1970 after which the password can change.
The number of days since January 1, 1970 since the password was last changed.
The maximum number of days during which a password is valid.
The number of days of inactivity after a password has expired before the account is locked.
Answer:
EExplanation:
The chage command can change the following parameters related to user password expiry and aging:
The last password change date (-d or --lastday option)
The password expiry date (-E or --expiredate option)
The minimum number of days between password changes (-m or --mindays option)
The maximum number of days during which a password is valid (-M or --maxdays option)
The number of days of warning before password expires (-W or --warndays option)
The chage command cannot change the number of days of inactivity after a password has expired before the account is locked. This parameter is controlled by the -I or --inactive option of the usermod command, which modifies the user account information. The chage command only displays the current value of this parameter, but does not allow changing it. References:
chage command in Linux with examples - GeeksforGeeks
10 chage command examples in Linux [Cheat Sheet] - GoLinuxCloud
How to Use the Chage Command in Linux – TecAdmin
How to Manage User Password Expiration and Aging in Linux - Tecmint
Which of the following commands can be used to convert text files in one character encoding to another character encoding?
Options:
cat
convert
dd
iconv
utf2utf
Answer:
DExplanation:
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 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)
Options:
export LANGUAGE="pt"
export MESSAGE="pt"
export LANG="pt"
export LC_MESSAGES="pt"
export ALL_MESSAGES="pt"
Answer:
C, DExplanation:
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]
What is the purpose of the iconv command?
Options:
It converts bitmap images from one format to another such as PNG to JPEG.
It verifies that the root directory tree complies to all conventions from the Filesystem Hierarchy Standard (FHS).
It displays additional meta information from icon files ending in .ico.
It changes the mode of an inode in the ext4 file system.
It converts files from one character encoding to another.
Answer:
EExplanation:
The iconv command is used to convert the encoding of a file from one character set to another. A character set is a collection of characters that are assigned numerical values called code points. Different character sets may use different numbers of bytes to represent each character, and may have different mappings of code points to characters. For example, ASCII is a single-byte character set that encodes 128 characters, while UTF-8 is a variable-length character set that can encode over a million characters. The iconv command can convert between many different character sets, such as ASCII, UTF-8, ISO-8859-1, etc. The basic syntax for using the command is as follows:
iconv [options] -f from-encoding -t to-encoding input-file > output-file
The -f option specifies the encoding of the input file, and the -t option specifies the encoding of the output file. The input file is read from standard input, and the output file is written to standard output, unless specified otherwise. The iconv command can also list all the supported character sets with the -l option1234. References:
How To Use the iconv Command on Linux - How-To Geek
iconv command in Linux with Examples - GeeksforGeeks
iconv - convert file encoding from one character set to another | Linux …
Using iconv to change character encodings - FileFormat.Info
The system's timezone may be set by linking /etc/localtime to an appropriate file in which directory? (Provide the full path to the directory, without any country information)
Options:
Answer:
/usr/share/zoneinfo/
Explanation:
The /usr/share/zoneinfo directory contains the binary time zone files that are used by the system to determine the local time for any region. The files are organized in subdirectories by continent, country, or ocean. Some files represent the standard time zones, while others may have historical or political variations. To set the system’s timezone, one can create a symbolic link from /etc/localtime to the appropriate file in the /usr/share/zoneinfo directory. For example, to set the timezone to America/New_York, one can use the command sudo ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime. Alternatively, one can use the timedatectl command to set the timezone without creating the link manually. References:
How to Set or Change the Time Zone in Linux | Linuxize
4 Ways to Change the Timezone in Linux - wikiHow
In case neither cron.allow nor cron.deny exist in /etc/, which of the following is true?
Options:
Without additional configuration, no users may have user specific crontabs.
Without additional configuration, all users may have user specific crontabs.
The cron daemon will refuse to start and report missing files in the system's logfile.
When a user creates a user specific crontab the system administrator must approve it explicitly.
Answer:
BExplanation:
The /etc/cron.allow and /etc/cron.deny files are used to control access to the crontab command and cron jobs for individual users. If neither of these files exists, then depending on site-dependent configuration parameters, only the superuser (root user) will be allowed to use this command, or all users will be able to use this command1. The default behavior of most Linux distributions is to allow all users to use the crontab command and have user specific crontabs if neither /etc/cron.allow nor /etc/cron.deny exists23. Therefore, option B is the correct answer. The other options are not true because:
Option A is false because it contradicts the default behavior of most Linux distributions.
Option C is false because the cron daemon will not refuse to start or report missing files in the system’s logfile if neither /etc/cron.allow nor /etc/cron.deny exists. The cron daemon will start normally and use the default configuration parameters1.
Option D is false because the system administrator does not need to approve user specific crontabs explicitly. The user can create, edit, display, or remove their own crontab files without any intervention from the system administrator1. References:
How cron.allow and cron.deny can be used to limit access to crontab for a particular user | The Geek Search
crontab(1) — cron — Debian bullseye — Debian Manpages
Controlling Access to crontab (System Administration Guide: Basic Administration) - Oracle
/etc/cron.allow - Linux Bash Shell Scripting Tutorial Wiki - nixCraft
What command will display the group names and GIDs to which a user belongs? (Provide only the command name with or without path information)
Options:
Answer:
id, /usr/bin/id
Explanation:
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
The correct crontab entry to execute the script chklog three times per month between 3 p.m. and 5 p.m.:
Options:
* 3,4,5 1 * * chklog
3 3,4,5 1 * * chklog
3 15,16,17 * * * chklog
0 15,16,17 1 * * chklog
* 15,16,17 1 * * chklog
Answer:
CExplanation:
The correct crontab entry to execute the script chklog three times per month between 3 p.m. and 5 p.m. is:
3 15,16,17 * * * chklog
The crontab entry has five fields that specify the time and frequency of the job, followed by the command or script to be executed. The fields are:
Minute: the minute of the hour when the job should run, from 0 to 59
Hour: the hour of the day when the job should run, from 0 to 23 (in 24-hour format)
Day of month: the day of the month when the job should run, from 1 to 31
Month: the month of the year when the job should run, from 1 to 12
Day of week: the day of the week when the job should run, from 0 to 6 (where 0 and 7 are Sunday)
The asterisk (*) means any value, and the comma (,) means a list of values. Therefore, the crontab entry above means:
Run the job at the 3rd minute of the hour
Run the job at the 15th, 16th, and 17th hour of the day (which are 3 p.m., 4 p.m., and 5 p.m.)
Run the job on any day of the month
Run the job on any month of the year
Run the job on any day of the week
This will execute the script chklog three times per day, every day of the month, and every month of the year, which is equivalent to three times per month.
The other options are incorrect because:
A. This will run the job at any minute of the hour, but only at the 3rd, 4th, and 5th hour of the day (which are 3 a.m., 4 a.m., and 5 a.m.), and only on the 1st day of the month.
B. This will run the job at the 3rd minute of the hour, but only at the 3rd, 4th, and 5th hour of the day (which are 3 a.m., 4 a.m., and 5 a.m.), and only on the 1st day of the month.
D. This will run the job at the 0th minute of the hour (which is the top of the hour), but only at the 15th, 16th, and 17th hour of the day (which are 3 p.m., 4 p.m., and 5 p.m.), and only on the 1st day of the month.
E. This will run the job at any minute of the hour, but only at the 15th, 16th, and 17th hour of the day (which are 3 p.m., 4 p.m., and 5 p.m.), and only on the 1st day of the month.
References:
Crontab Explained in Linux [With Examples]
‘crontab’ in Linux with Examples - GeeksforGeeks
Linux Crontab Command Help and Examples - Computer Hope
Crontab in Linux with 20 Useful Examples to Schedule Jobs - TecAdmin
Linux crontab tutorial with Examples - Linux Tutorials - Learn Linux …
Which directory in /etc is used to keep a sample copy of files and directories for when a new user has a home directory created? (Please provide the full path)
Options:
Answer:
/etc/skel, /etc/skel/
Explanation:
The /etc/skel directory is used to keep a sample copy of files and directories for when a new user has a home directory created. The /etc/skel directory contains files and directories that are automatically copied over to a new user’s home directory when such user is created by the useradd or adduser command. The /etc/skel directory allows the system administrator to create a standard environment for all new users on the system. For example, the /etc/skel directory may contain a default .bashrc file that sets some aliases and environment variables for the new user, or a default .profile file that executes some commands at login. The /etc/skel directory may also contain subdirectories such as .ssh or .config that store configuration files for various applications or services. The name /etc/skel comes from the word “skeleton”, as it provides a basic structure for the new user’s home directory. References:
[Linux User Administration]
[Linux Directory Structure]
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?
Options:
CASE
FROM
WHERE
IF
Answer:
CExplanation:
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]
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.)
Options:
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.
Answer:
B, C, DExplanation:
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 output will the following command produce?
seq 1 5 20
Options:
1
6
1
1
1
6
1
5
10
15
1
2
3
4
2
3
4
5
5
10
15
20
Answer:
BExplanation:
The seq command in Linux is used to generate a sequence of numbers from FIRST to LAST in steps of INCREMENT1. The syntax for the seq command is:
seq [OPTION]… LAST or seq [OPTION]… FIRST LAST or seq [OPTION]… FIRST INCREMENT LAST
In this case, the command seq 1 5 20 has three arguments: FIRST = 1, INCREMENT = 5, and LAST = 20. This means that the command will produce numbers from 1 to 20 in steps of 5. The output will be:
1 5 10 15
The output will not include 20 because it is not a multiple of 5. The output will be printed on separate lines by default, unless a different separator is specified with the -s option2. References:
Seq Command in Linux [Explained With Examples]
seq Man Page - Linux - SS64.com - SS64 Command line reference
After issuing:
function myfunction { echo $1 $2 ; }
in Bash, which output does:
myfunction A B C
Produce?
Options:
A B
A B C
A C
B C
C B A
Answer:
AExplanation:
In Bash, a function is a block of code that can be invoked by its name. A function can take arguments, which are passed to the function as positional parameters. The $1 variable refers to the first argument, $2 to the second argument, and so on. The function can access the number of arguments passed to it by using the $# variable. In this case, the function myfunction simply echoes the first and second arguments to the standard output. Therefore, when the command myfunction A B C is executed, the output is A B, since the third argument C is ignored by the function. References:
[LPI Linux Essentials - Topic 103: Command Line Basics]
[Bash Functions]
What command displays all aliases defined in the current shell? (Specify the command without any path information)
Options:
Answer:
alias, alias -p
Explanation:
The alias command is used to create, list, or remove aliases in the current shell. An alias is a short name that refers to another command, usually with some options or arguments. Aliases are useful for saving typing time, avoiding spelling errors, or customizing the behavior of commands. To list all the aliases defined in the current shell, we can use the alias command without any arguments. This will print the aliases in the format of alias name='command'123. For example:
$ alias alias cp=‘cp -i’ alias l=‘ls -CF’ alias la=‘ls -A’ alias ll=‘ls -alF’ alias mv=‘mv -i’ alias rm=‘rm -i’
The output shows that some common commands, such as cp, mv, and rm, have aliases that add the -i option, which prompts the user before overwriting or deleting files. The l, la, and ll aliases are shortcuts for different variations of the ls command, which lists files and directories123.
References: 1: List All Available Commands and Aliases in Linux - Baeldung 2: get all aliases in linux shell - Stack Overflow 3: How to list all aliases on Linux - Linux Tutorials - Learn Linux Configuration
What output will the command seq 10 produce?
Options:
A continuous stream of numbers increasing in increments of 10 until stopped.
The numbers 1 through 10 with one number per line.
The numbers 0 through 9 with one number per line.
The number 10 to standard output.
Answer:
BExplanation:
The seq command in Linux is used to print a sequence of numbers, which can be piped to other commands or used in for loops and bash scripts1. The command can generate a list of integers or real numbers, with options to control the start, end, and increment of the sequence. The general syntax of the command is seq [options] specification1.
If you launch seq with a single number as a command-line parameter, it counts from one to that number. It then prints the numbers in the terminal window, one number per line2. For example, seq 10 will produce the following output:
1
2
3
4
5
6
7
8
9
10
Therefore, the correct answer is B. The numbers 1 through 10 with one number per line.
References: 1: 10+ Seq Commands with Examples in Linux – LinuxWizardry 2: How to Use the seq Command on Linux - How-To Geek
What keyword is missing from this code sample of a shell script?
____ i in *.txt; do
echo $i
done
Options:
for
loop
until
while
Answer:
BExplanation:
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
By default, the contents of which directory will be copied to a new user's home directory when the account is created by passing the -m option to the useradd command? (Specify the full path to the directory.)
Options:
Answer:
/etc/skel
Explanation:
The /etc/skel directory contains files and directories that are used as a template for creating a new user’s home directory. The useradd command uses the -m (or --create-home) option to create the user home directory as /home/username and copy the files from /etc/skel to it. The files in /etc/skel are typically initialization files such as .bashrc, .profile, and .bash_logout that set the user’s environment variables, aliases, and other preferences. The system administrator can customize the /etc/skel directory to provide a consistent and convenient initial setup for new users. References:
How can the existing environment variable FOOBAR be suppressed for the execution of the script./myscript only?
Options:
unset -v FOOBAR;./myscript
set -a FOOBAR="";./myscript
env -u FOOBAR./myscript
env -i FOOBAR./myscript
Answer:
CExplanation:
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 files, when existing, affect the behavior of the Bash shell? (Choose TWO correct answers.)
Options:
~/.bashconf
~/.bashrc
~/.bashdefaults
~/.bash_etc
~/.bash_profile
Answer:
B, EExplanation:
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
Which of the following commands lists all defined variables and functions within Bash?
Options:
env
set
env -a
echo $ENV
Answer:
BExplanation:
The set command lists all defined variables and functions within Bash, including local, environment, and shell variables, as well as aliases and functions. The output of set can be very long, so it is often piped to less, grep, or other commands for filtering or paging. The set command can also be used to set or unset shell options and positional parameters. The -o posix option to set limits the output to only variables, as defined by the POSIX standard123.
The env command lists only the environment variables, which are a subset of the shell variables that are passed to child processes. The env command can also be used to run a command in a modified environment, or to print or set environment variables. The -a option to env is not valid in most implementations45.
The echo command prints a line of text to the standard output. The $ENV variable is not a predefined variable in Bash, but it can be set by the user or by other programs. If it is not set, echo $ENV will print a blank line1 . References:
What is the default name of the configuration file for the Xorg X11 server? (Specify the file name only without any path.)
Options:
Answer:
xorg.conf
Explanation:
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
What is the purpose of the Sticky Keys feature in X?
Options:
To assist users who have difficulty holding down multiple keys at once
To prevent repeated input of a single character if the key is held down
To ignore brief keystrokes according to a specified time limit
To repeat the input of a single character
Answer:
AExplanation:
The Sticky Keys feature in X is an accessibility option that allows users to press modifier keys (such as Ctrl, Alt, Shift, or the Windows key) one at a time, instead of holding them down simultaneously, to perform keyboard shortcuts. For example, to copy something, a user can press Ctrl, release it, and then press C, instead of pressing Ctrl+C together. This can be helpful for users who have difficulty pressing multiple keys at once, or who prefer not to do so. References:
Which of the following lines is an example of a correct setting for the DISPLAY environment variable?
Options:
hostname:displayname
hostname:displaynumber
hostname/displayname
hostname/displaynumber
hostname
Answer:
BExplanation:
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
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.)
Options:
Answer:
xdm
Explanation:
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?
Options:
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.
Answer:
BExplanation:
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
Your senior administrator asked you to change the default background of his machine, which uses XDM. Which file would you edit to achieve this?
Options:
/etc/X11/xdm/Xsetup
/etc/X11/xdm.conf
/etc/X11/xdm/Defaults
/etc/X11/defaults.conf
Answer:
AExplanation:
The file /etc/X11/xdm/Xsetup contains commands that are executed by XDM before displaying the login screen. This file can be used to set the background image, color, or run other programs on the X display. The other files are either not related to XDM or do not exist by default. References:
XDM - ArchWiki
Customizing the XDM Login Screen | Linux Journal
Which of the following are tasks handled by a display manager like XDM or KDM? (Choose TWO correct answers.)
Options:
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.
Answer:
A, CExplanation:
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
What is the purpose of a screen reader?
Options:
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.
Answer:
AExplanation:
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)
Which file used by XDM specifies the default wallpaper?
Options:
/etc/X11/xdm/Xsetup
/etc/X11/xdm.conf
/etc/X11/xdm/Defaults
/etc/X11/defaults.conf
Answer:
AExplanation:
The file that specifies the default wallpaper for XDM is /etc/X11/xdm/Xsetup. XDM is a display manager for the X Window System that provides a graphical login screen and manages user sessions. The /etc/X11/xdm/Xsetup file is executed when XDM starts the X server and before any user login or session starts. This file can be used to configure the X server, set X resources, and perform any other system-wide setup tasks, such as setting the wallpaper. To set the wallpaper, one can use a command like qiv -z /usr/local/share/backgrounds/wallpaper.jpg in the /etc/X11/xdm/Xsetup file, where qiv is an image viewer and /usr/local/share/backgrounds/wallpaper.jpg is the path to the desired wallpaper image1.
The other options are not correct/etc/X11/xdm.conf is the configuration file for XDM, which specifies how XDM should behave, such as the access control, the login window, and the session types2/etc/X11/xdm/Defaults is the directory where the default XDM configuration files are stored, such as Xresources, Xsession, and Xwilling2. /etc/X11/defaults.conf is not a valid file or directory related to XDM or X Window System. References:
XDM - ArchWiki
Configuring XDM - Linux Documentation Project
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.)
Options:
Answer:
/usr/bin/xwininfo, xwininfo
Explanation:
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:
On a system running the KDE Display Manager, when is the /etc/kde4/kdm/Xreset script automatically executed?
Options:
When KDM starts
When a user's X session exits
When KDM crashes
When X is restarted
When X crashes
Answer:
BExplanation:
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 …
The X11 configuration file xorg.conf is grouped into sections. How is the content of the section SectionName associated with that section?
Options:
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.
Answer:
BExplanation:
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
Which of the following tasks can be accomplished using the command date? (Choose TWO correct answers.)
Options:
Synchronize the hardware and system clocks.
Output date and time in different formats.
Set the system clock.
Set the hardware clock.
Update the time via NTP.
Answer:
BExplanation:
The date command is used to display and set the system date and time. It can also be used to print the time in different formats and calculate future and past dates. The date command has the following syntax:
date [option]... [+format]
The format controls begin with the % symbol and are substituted by their current values. For example, to display the current year, month, and day, we can use the following command:
date +"Year: %Y, Month: %m, Day: %d"
To set the system clock manually, we can use the --set or -s option followed by the date and time string. For example, to set the date and time to 5:30 PM, May 13, 2010, we can use the following command:
date --set="20100513 05:30"
The other tasks are not possible with the date command because:
Synchronize the hardware and system clocks: The date command cannot synchronize the hardware and system clocks. To do this, we need to use the hwclock command, which can read or set the hardware clock, and also synchronize it with the system clock.
Set the hardware clock: The date command cannot set the hardware clock. To do this, we need to use the hwclock command with the --systohc or -w option, which will copy the system time to the hardware clock.
Update the time via NTP: The date command cannot update the time via NTP (Network Time Protocol). To do this, we need to use the ntpdate command, which will query an NTP server and set the system clock accordingly.
References:
Date Command in Linux: How to Set, Change, Format and Display Date
date command in Linux with examples - GeeksforGeeks
Date Command in Linux | Linuxize
What is true regarding the command sendmail?
Options:
With any MTA, the sendmail command must be run periodically by the cron daemon.
All MTAs, including Postfix and Exim, provide a sendmail command.
The sendmail command prints the MTAs queue history of which mails have been sent successfully.
It is only available when the sendmail MTA is installed.
Answer:
BExplanation:
The sendmail command is a generic interface to various mail transfer agents (MTAs), such as Sendmail, Postfix, Exim, Qmail, etc. The sendmail command is used to send emails from the command line or from other programs that need to deliver emails. The sendmail command accepts various flags and parameters to specify the sender, recipient, subject, body, and attachments of the email. The sendmail command also reads the standard input for the email content if no file is specified. The sendmail command is part of the sendmail package, which is the original and most widely used MTA for Unix-like systems. However, other MTAs, such as Postfix and Exim, also provide a sendmail command for compatibility reasons. The sendmail command provided by these MTAs may have slightly different syntax and options, but they all support the basic functionality of sending emails. Therefore, the statement that all MTAs, including Postfix and Exim, provide a sendmail command is true123.
The other statements are false. The sendmail command does not need to be run periodically by the cron daemon, as it is not a daemon itself, but a command-line tool. The sendmail command does not print the MTA’s queue history, but rather sends the email to the MTA for delivery. The sendmail command is not only available when the sendmail MTA is installed, but also when other MTAs that provide a sendmail command are installed. References: 1: Linux Sendmail Command Help and Examples - Computer Hope 2: Send Email in Linux from Command Line | DigitalOcean 3: 5 Ways To Send Email from Linux Command Line - TecAdmin
Which command, available with all MTAs, is used to list the contents of the MTA's mail queue? (Specify ONLY the command without any path or parameters.)
Options:
Answer:
mailq, /usr/bin/mailq, sendmail -bp, /usr/sbin/sendmail -bp, /usr/lib/sendmail -bp, sendmail, /usr/sbin/sendmail, /usr/lib/sendmail
Explanation:
The command that is used to list the contents of the MTA’s mail queue is mailq12. This command is available with all MTAs, such as sendmail, postfix, exim, etc12. The mailq command prints the mail queue, which is the list of messages that are waiting to be sent12. The output of the mailq command shows the queue ID, size, time, sender, and recipient of each message12. The mailq command can also take various options to modify the output, such as -v for verbose mode, -Ac for mail submission queue, -qL for lost items, and -qQ for quarantined items3.
References: 1: mailq Command in Linux with Examples - GeeksforGeeks 2: mailq Command Examples in Linux – The Geek Diary 3: linux - How to see entire sendmail queue? - Server Fault
Which of the following commands is used to rotate, compress, and mail system logs?
Options:
rotatelog
striplog
syslogd --rotate
logrotate
logger
Answer:
DExplanation:
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
Why is the correct configuration of a system's time zone important?
Options:
Because the conversion of Unix timestamps to local time relies on the time zone configuration.
Because the time zone is saved as part of the modification times of files and cannot be changed after a file is created.
Because the environment variables LANG and LC_MESSAGES are, by default, set according to the time zone.
Because NTP chooses servers nearby based on the configured time zone.
Answer:
AExplanation:
The correct configuration of a system’s time zone is important because it affects how the system displays and interprets the local time from the Unix timestamps. A Unix timestamp is a number that represents the number of seconds that have elapsed since January 1, 1970 (UTC)1. Unix timestamps are independent of time zones and are the same for all systems1. However, when a system needs to display or interpret the local time from a Unix timestamp, it needs to know the offset from UTC, which is determined by the time zone configuration23. If the time zone configuration is incorrect, the system may display or interpret the local time incorrectly, which can cause problems with scheduling tasks, logs, and other applications45.
For example, suppose a system has a Unix timestamp of 1638374400, which corresponds to December 1, 2021, 12:00:00 UTC6. If the system’s time zone is configured correctly as UTC, it will display the local time as December 1, 2021, 12:00:00. However, if the system’s time zone is configured incorrectly as EST (Eastern Standard Time), which is 5 hours behind UTC, it will display the local time as December 1, 2021, 07:00:00, which is 5 hours earlier than the actual local time6. This can lead to confusion and errors for the system and the user.
Therefore, the correct answer is A. Because the conversion of Unix timestamps to local time relies on the time zone configuration.
References: 1: Unix time - Wikipedia 2: How to Set or Change the Time Zone in Linux – TecAdmin 3: Set the date, time, and timezone on a Linux server 4: Configure the time zone (TZ) on Linux systems - Linux Audit 5: Setting the timezone under Linux - Learn Linux Configuration 6: Epoch Converter - Unix Timestamp Converter
Which of the following are commonly used Mail Transfer Agent (MTA) applications? (Choose THREE correct answers.)
Options:
Postfix
Procmail
Sendmail
Exim
SMTPd
Answer:
A, C, DExplanation:
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]
To exclude all log messages of a given logging facility, you should use a logging priority of _____ .
Options:
Answer:
none
Explanation:
To exclude all log messages of a given logging facility, you should use a logging priority of none. This means that no messages from that facility will be logged, regardless of their severity level. For example, if you want to exclude all messages from the local0 facility, you can use local0.none in your syslog configuration file. This will prevent any messages from local0 from being written to any log file or destination that matches that selector12. The logging priority of none 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: logging - exclude syslog facility from all others - Server Fault 2: rsyslog.conf(5) - Linux manual page - man7.org 3: Exam 102 Objectives
Which of the following is observed and corrected by a NTP client?
Options:
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.
Answer:
BExplanation:
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
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.)
Options:
Answer:
lpq, /usr/bin/lpq, lpstat, /usr/bin/lpstat
Explanation:
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
What entry can be added to the syslog.conf file to have all syslog messages generated by a system displayed on console 12?
Options:
*.* /dev/tty12
/var/log/messages | /dev/tty12
| /dev/tty12
syslog tty12
mail.* /dev/tty12
Answer:
AExplanation:
The entry that can be added to the syslog.conf file to have all syslog messages generated by a system displayed on console 12 is A. . /dev/tty12. This entry consists of a selector field and an action field, separated by a space or a tab. The selector field specifies the pattern of facilities and priorities that match the action. The action field specifies the destination where the matching messages are sent. In this case, the selector field is ., which means all facilities and all priorities. The action field is /dev/tty12, which is the device file for the console 12. This means that any syslog message generated by the system will be displayed on the console 12, regardless of its facility or priority. This can be useful for debugging or monitoring purposes, but it can also be very noisy and distracting, as it will show all kinds of messages, including debug, info, notice, warning, err, crit, alert, and emerg12.
The other options are not correct. Option B. /var/log/messages | /dev/tty12 is invalid, as it uses a pipe (|) character in the selector field, which is not allowed. The pipe character can only be used in the action field to indicate that the matching messages are piped to an external program1. Option C. | /dev/tty12 is also invalid, as it has an empty selector field, which is not allowed. The selector field must specify at least one facility and one priority1. Option D. syslog tty12 is also invalid, as it has a missing period (.) between the facility and the priority in the selector field, and a missing slash (/) before the device file in the action field. The correct syntax for this option would be syslog.* /dev/tty12, which would display only the messages with the syslog facility and any priority on the console 121. Option E. mail.* /dev/tty12 is valid, but it would not display all syslog messages generated by a system, but only the messages with the mail facility and any priority on the console 12. This would exclude the messages from other facilities, such as auth, cron, daemon, kern, user, etc1. References: 1: syslog.conf (5) - Linux man page 2: Beginner’s Guide to Syslogs in Linux [Real World Examples]