Free RHCE System Configuration and Management Questions and Answers — Questions and Answers
Question 1: What services need to run at boot for NFS (Network File System) to function correctly?
- sshd and nfslock
- httpd and rpcbind
- nfs-server and nfslock
- rpcbind, nfs, and nfslock (Correct answer)
Correct answer: rpcbind, nfs, and nfslock
For NFS (Network File System) to function correctly, several services must be running and enabled at boot. `rpcbind` handles RPC (Remote Procedure Call) program number-to-port mappings, which is essential for NFS communication. The `nfs` service is the core NFS server, and `nfslock` provides crucial file locking services for data integrity when multiple clients access shared files.
Question 2: How do you mount an NFS share from the command line?
- mount -t nfs server.example.com:/nfs_share /mnt (Correct answer)
- mount nfs server.example.com:/nfs_share /mnt
- mount -t nfs /nfs_share server.example.com:/mnt
- mount -nfs server.example.com:/mnt /nfs_share
Correct answer: mount -t nfs server.example.com:/nfs_share /mnt
To manually mount an NFS share from the command line, the `mount` command is used with the `-t nfs` option to specify the filesystem type. The syntax requires the remote server and export path (`server.example.com:/nfs_share`) followed by the local mount point (`/mnt`). This command temporarily mounts the NFS share for immediate access.
Question 3: How do you mount an NFS share using fstab?
- nfsserver:/exports /mount-point nfs defaults 0 0 (Correct answer)
- mount -t nfs nfsserver:/exports /mount-point
- nfs mount nfsserver:/exports /mount-point
- fstab mount nfsserver:/exports /mount-point nfs
Correct answer: nfsserver:/exports /mount-point nfs defaults 0 0
To automatically mount an NFS share at boot, an entry must be added to the `/etc/fstab` file. The correct format specifies the remote NFS share (`nfsserver:/exports`), the local mount point (`/mount-point`), the filesystem type (`nfs`), mount options (`defaults`), and dump/pass values (`0 0`). This ensures the share is available every time the system starts.
Question 4: How do you add a Samba user?
- adduser -s engineer1
- smbpasswd -a engineer1 (Correct answer)
- samba-adduser engineer1
- useradd -m -s /sbin/nologin engineer1
Correct answer: smbpasswd -a engineer1
To add a user to Samba, you use the `smbpasswd` command with the `-a` (add) option, followed by the username. This command prompts for a new Samba password for the specified user, which is separate from their system password. This allows users to authenticate specifically with Samba shares.
Question 5: How do you install the SELinux GUI?
- yum install -y selinux-gui
- yum install -y policycoreutils-gui (Correct answer)
- yum install -y selinux-gui-tools
- yum install -y selinux-policy-gui
Correct answer: yum install -y policycoreutils-gui
On Red Hat-based systems, the graphical user interface (GUI) tools for managing SELinux are provided by the `policycoreutils-gui` package. Installing this package via `yum` (or `dnf` on newer systems) provides tools like `sealert` and `system-config-selinux` for easier SELinux configuration and troubleshooting, making policy management more accessible.
Question 6: (SHELL) How do you tell if a file is of a certain type?
- file /var/cache/man/whatis
- ls -t /var/cache/man/whatis
- type /var/cache/man/whatis
- test -f /var/cache/man/whatis (Correct answer)
Correct answer: test -f /var/cache/man/whatis
The `test` command (or its shorthand `[ ]`) is a fundamental shell command used to check file types and other conditions. The `-f` option specifically tests if a given path refers to a regular file that exists. This is commonly used in shell scripts for conditional logic, allowing scripts to behave differently based on file properties.
Question 7: Which Ansible module is used for creating and editing filesystems?
- fs
- disk
- mount (Correct answer)
- filesystem
Correct answer: mount
In Ansible, the `mount` module is used to manage filesystems, including ensuring they are mounted or unmounted to a desired state. While it doesn't directly create a filesystem (like `mkfs`), it handles the configuration of mount points and ensures the correct state of filesystem mounts. It can also manage entries in `/etc/fstab` for persistent mounts.
What services need to run at boot for NFS (Network File System) to function correctly?