Add sudo Permission Configuration
Allow members of the sysmgrs group to use sudo without entering a password.
[root@node1 ~]# visudo
...
%wheel ALL=(ALL) NOPASSWD: ALL
%sysmgrs ALL=(ALL) NOPASSWD: ALL
# Verification (mandatory operation)
[root@node1 ~]# su - natasha
[natasha@node1 ~]# sudo cat /etc/shadow
Configure NTP
Configure your system to synchronize with the NTP server of materials.example.com (Note: materials.example.com is an alias for classroom.example.com).
# Install the chrony service for configuring NTP server
[root@node1 ~]# yum -y install chrony
[root@node1 ~]# vim /etc/chrony.conf
server materials.example.com iburst
[root@node1 ~]# systemctl restart chronyd
[root@node1 ~]# systemctl enable chronyd
# Check
# Set an arbitrary time
[root@node1 ~]# date -s "1982-1-1"
Fri Jan 1 12:00:00 AM EST 1982
# Restart the NTP server
[root@node1 ~]# systemctl restart chronyd
# Check if the time is synchronized
# Execute after 3-5 seconds, too fast won't synchronize the time
[root@node1 ~]# date
Tue Dec 12 11:40:19 PM EST 2023
# Use the chronyc command to check synchronization status
[root@node1 ~]# chronyc sources -v
.-- Source mode '^' = server, '=' = peer, '#' = local clock.
/ .- Source state '*' = current best, '+' = combined, '-' = not combined,
| / 'x' = may be in error, '~' = too variable, '?' = unusable.
|| .- xxxx [ yyyy ] +/- zzzz
|| Reachability register (octal) -. | xxxx = adjusted offset,
|| Log2(Polling interval) --. | | yyyy = measured offset,
|| \ | | zzzz = estimated error.
|| | | \
MS Name/IP address Stratum Poll Reach LastRx Last sample
^* classroom.lab.example.com 8 6 17 42 -14us[ -11us] +/- 463us
Create a systemd timer that runs backup-now.service every day at 02:00.
Explanation:
Solution:
Create timer unit:
cat > /etc/systemd/system/backup-now.timer < < 'EOF'
[Unit]
Description=Daily backup timer
[Timer]
OnCalendar=*-*-* 02:00:00
Persistent=true
[Install]
WantedBy=timers.target
EOF
Enable it:
systemctl daemon-reload
systemctl enable --now backup-now.timer
systemctl list-timers --all | grep backup-now
Detailed Explanation:
* OnCalendar=*-*-* 02:00:00 means daily at 02:00.
* Persistent=true runs missed jobs after boot if the system was off.
* timers.target is the normal target for timer units.
* RHEL 10 documentation includes systemd timer units as a standard scheduling mechanism. ( Red Hat
Documentation )
Find all files owned by user tom and copy them into /root/tomfiles.
Explanation:
Solution:
* Create the destination directory if needed:
mkdir -p /root/tomfiles
* Find and copy:
find / -type f -user tom -exec cp -pvf {} /root/tomfiles/ \;
Detailed Explanation:
* find / searches the whole filesystem.
* -type f restricts results to files.
* -user tom matches owner tom.
* -exec cp -pvf copies each file with verbose and force options.
* mkdir -p is added as a safe preparation step.
Configure Cron Job
Configure a cron job to automatically execute /usr/bin/echo hello every day at 14:23 for the user harry.
[root@node1 ~]# systemctl status crond
[root@node1 ~]# systemctl enable crond
[root@node1 ~]# crontab -e -u harry
23 14 * * * /usr/bin/echo hello
# Verification
[root@node1 ~]# crontab -l -u harry
Set the default UMASK for user-created files
For the user natasha:
* The default permission for newly created files should be r--r--r--
* The default permission for newly created directories should be r-xr-xr-x
# su - natasha
Write the umask setting into the user's .bashrc file in the home directory:
bash
Copy code
echo 'umask 222' >> .bashrc
source .bashrc
Command explanation:
umask is used to control the default permissions for files and directories created by a user.
In umask:
The first digit is for special permissions and is usually 0 (can be omitted if not needed).
The second digit controls owner permissions.
The third digit controls group permissions.
The fourth digit controls permissions for others.
Create a snapshot of the Stratis file system fs1 in pool pool1 named fs1-snap.
Explanation:
Solution:
stratis filesystem snapshot pool1 fs1 fs1-snap
stratis filesystem list
Detailed Explanation:
* This creates a snapshot of the existing Stratis file system.
* Snapshots are useful for rollback, backup, and testing operations.
* Stratis features, including pool and file-system management, are part of RHEL 10 file-system
administration. ( Red Hat Documentation )