Practice Free XK0-005 Exam Online Questions
Question #151
A new Linux systems administrator just generated a pair of SSH keys that should allow connection to the servers.
Which of the following commands can be used to copy a key file to remote servers? (Choose two.)
- A . wget
- B . ssh-keygen
- C . ssh-keyscan
- D . ssh-copy-id
- E . ftpd
- F . scp
Correct Answer: D,F
D,F
Explanation:
The commands ssh-copy-id and scp can be used to copy a key file to remote servers. The command ssh-copy-id copies the public key to the authorized_keys file on the remote server, which allows the user to log in without a password. The command scp copies files securely over SSH, which can be used to transfer the key file to any location on the remote server. The other options are incorrect because they are not related to copying key files. The command wget downloads files from the web, the command ssh-keygen generates key pairs, the command ssh-keyscan collects public keys from remote hosts, and the command ftpd is a FTP server daemon. CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 13: Managing Network Services, pages 408-410.
D,F
Explanation:
The commands ssh-copy-id and scp can be used to copy a key file to remote servers. The command ssh-copy-id copies the public key to the authorized_keys file on the remote server, which allows the user to log in without a password. The command scp copies files securely over SSH, which can be used to transfer the key file to any location on the remote server. The other options are incorrect because they are not related to copying key files. The command wget downloads files from the web, the command ssh-keygen generates key pairs, the command ssh-keyscan collects public keys from remote hosts, and the command ftpd is a FTP server daemon. CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 13: Managing Network Services, pages 408-410.
Question #152
A Linux administrator is configuring Apache on a system and needs to allow the service to start after every startup.
Which of the following commands will allow the Linux administrator to accomplish this task while starting the service at the same time?
- A . systemctl mask –state=active httpd
- B . systemctl start –runtime boot httpd
- C . systemctl set-property restart httpd
- D . systemctl enable –now httpd
Correct Answer: D
D
Explanation:
D is correct: systemctl enable –now both enables the service to start on boot and starts it immediately.
Incorrect Options:
A: mask disables a service entirely.
B: Invalid syntax.
C: set-property modifies unit properties, not enablement.
Reference: CompTIA Linux+ XK0-005 Study Guide, Chapter 10 man systemctl
D
Explanation:
D is correct: systemctl enable –now both enables the service to start on boot and starts it immediately.
Incorrect Options:
A: mask disables a service entirely.
B: Invalid syntax.
C: set-property modifies unit properties, not enablement.
Reference: CompTIA Linux+ XK0-005 Study Guide, Chapter 10 man systemctl
Question #153
A Linux administrator created the directory /project/access2all. By creating this directory, the administrator is trying to avoid the deletion or modification of files from non-owners.
Which of the following will accomplish this goal?
- A . chmod +t /project/access2all
- B . chmod +rws /project/access2all
- C . chmod 2770 /project/access2all
- D . chmod ugo+rwx /project/access2all
Correct Answer: A
A
Explanation:
The command that will accomplish the goal of avoiding the deletion or modification of files from non-owners is chmod +t /project/access2all. This command will set the sticky bit on the directory /project/access2all, which is a special permission that restricts file deletion or renaming to only the file owner, directory owner, or root user. This way, even if multiple users have write permission to the directory, they cannot delete or modify each other’s files.
The other options are not correct commands for accomplishing the goal. The chmod +rws /project/access2all command will set both the SUID and SGID bits on the directory, which are special permissions that allow a program or a directory to run or be accessed with the permissions of its owner or group, respectively. However, this does not prevent file deletion or modification from non-owners. The chmod 2770 /project/access2all command will set only the SGID bit on the directory, which means that any new files or subdirectories created in it will inherit its group ownership. However, this does not prevent file deletion or modification from non-owners. The chmod ugo+rwx /project/access2all command will grant read, write, and execute permissions to all users (user, group, and others) on the directory, which means that anyone can delete or modify any file in it. chmod(1) – Linux manual page; How to Use SUID, SGID, and Sticky Bits on Linux
A
Explanation:
The command that will accomplish the goal of avoiding the deletion or modification of files from non-owners is chmod +t /project/access2all. This command will set the sticky bit on the directory /project/access2all, which is a special permission that restricts file deletion or renaming to only the file owner, directory owner, or root user. This way, even if multiple users have write permission to the directory, they cannot delete or modify each other’s files.
The other options are not correct commands for accomplishing the goal. The chmod +rws /project/access2all command will set both the SUID and SGID bits on the directory, which are special permissions that allow a program or a directory to run or be accessed with the permissions of its owner or group, respectively. However, this does not prevent file deletion or modification from non-owners. The chmod 2770 /project/access2all command will set only the SGID bit on the directory, which means that any new files or subdirectories created in it will inherit its group ownership. However, this does not prevent file deletion or modification from non-owners. The chmod ugo+rwx /project/access2all command will grant read, write, and execute permissions to all users (user, group, and others) on the directory, which means that anyone can delete or modify any file in it. chmod(1) – Linux manual page; How to Use SUID, SGID, and Sticky Bits on Linux