RHCSA 9 Notes
RHCSA 9 Notes
File: /etc/yum.repos.d/
See enabled repositories
#dnf repolist enabled
Disable all repositories
#dnf config-manager –disable <repoID>
Create Yum repositories with the dnf config-manager command.
#dnf config-manager –add-repo=”http://rhatcert.com/repo”
Check repo was added: #dnf repolist enabled
USERS
File: /etc/passwd | /etc/shadow | /etc/group | /etc/gshadow | /etc/login.defs
Create users:
#useradd bob
The following configuration variables in /etc/login.defs change the behavior of this tool:
CREATE_HOME; PASS_MAX_DAYS (number) maximum number of days a password may be used.
To change the expiration of a password after X days, edit:
#vi /etc/shadow
To change home dicretory of a users edit:
#vi /etc/passwd
Create groups:
#vi groupadd trainers
#vi usermod -aG trainers bob
FILE ACCESS
r=4; w=2; x=1; rwx=7; rx=5 | Default for d = 0777 (drwxrwxrwx) | Default for f = 0666 (-rw-rw-rw-)
umask = 0002 clears the write bit for other users | 0077 clears all the group and other permissions of newly created files
Add read access only to a group other than the group owner of a folder/File | to verify the file acl was added
#setfacl -m g:consultants:rx /groups/trainers
#getfacl /group/trainers
Create Logical Volume named lvfiles in vgfiles group, allocate 100% of free space
#lvcreate -n <lvfiles> -l 100%FREE <vgfiles>
Mount volume on folder /files and make mount persistent. Reboot to verify is persistent
#mkdir /files
#mount /dev/vgfiles/lvfiles /files
#df -hT (to get the files system and type to add to /etc/fstab)
#vi /etc/fstab add line: /dev/mapper/vgfiles-lvfiles /files ext4 defaults 00
PERFORMANCE TUNING
Check if tuned is installed, if it’s running, make it enabled and change profile to bets throughput
#rpm -qa | grep tunned
#systemctl status tunned
#systemctl enabled tuned
#systemctl start tuned
#tuned-adm list
#tuned-adm profile network-throughput
#tuned-adm active
JOB SCHEDULING
Files: /etc/crontab | files in folder /etc/cron.d/ | /etc/cron.hourly/| /etc/cron.daily/ | /etc/
cron.weekly/ | /etc/cron.monthly/
One time for user at, atq #echo "date >> /home/student/myjob.txt" | at now +3min
Periodic tasks for Users #crontab -e ADD to file */2 * * * Mon-Fri /usr/bin/date >> ~/my_first_cron_job.txt
The /etc/anacrontab file ensures that scheduled jobs always run and are not skipped accidentally because the system
was turned off or hibernated.
System timers located: /usr/lib/systemd/system/sysstat-collect.timer
To modify copy timers to /etc/systemd/system/sysstat-collect.timer
To reload timer #systemctl daemon-reload
To enable timer #systemctl enable --now sysstat-collect.timer
Timer that triggers temporary file clean up systemd-tmpfiles-clean.timer
Diagram
Create a scheduled job to run at the top of every hour and send a message “hello” to the system-logging mechanism
#crontab -e
ADD LINE TO FILE AND SAVE: 59 * * * * logger -p user.notice "hello"
Using stratis add a 3G disk to volume named myvol and ensure it is mounted persistently and automatically when
booting.
Ensure stratis is installed
#rpm -qa | grep stratis
Install stratis
#dnf install stratis
#dnf install stratis-cli
Check the HD is added, create stratis pool and extend the pool
#lsblk
#stratis pool create <myvol> </dev/nvme0n2>
#stratis pool add-data <myvol> </dev/nvm0n3>
#stratis pool list
Find all files that have the SUID permission set and write results to file in home folder.
#find / -type f -perm -u+s -fprint /home/student/SUDI-files.txt
Create user lisa and change the max password days to 30, also ensure she changes password at first login
#useradd lisa -K PASS_MAX_DAYS=30 OR
#useradd lisa THEN #chage -M 30 dbuser1
#chage -d 0 lisa
Allow lisa to change anyone’s password except root | sudoers line syntax User Host = (Runas) Command
Command dnf is the latest version of YUM dnf links to dnf-3
firewall-cmd --list-all-zones
firewall-cmd –add-service=http
systemctl start httpd
SELinux commands
getenforce = See SELinux status
getenforce 0 = disable SELinux enforcement
getenforce 1 = enable SELinux enforcement
ls lZd /<directory> = shows file properties including SELinux file types
Instructor email
Barbara Stamatakis
[email protected]
[email protected]