RHCSA Flashcards
enable ssh access for root on both servers.
vi /etc/ssh/sshd_config
Change the following line (should be line 40):PermitRootLogin yes
systemctl restart sshd
Ensure network services start at boot.
systemctl status NetworkManager
Check to see that it’s enabled and running. If not, then runsystemctl enable --now NetworkManager
Set the target as multi-user and make sure it boots into that automatically. Reboot to confirm.
systemctl set-default multi-user systemctl reboot
Configure the network interfaces and hostnames
nmcli con show
Output shows enp0s8
as unconfigured
~~~
nmcli con mod enp0s8 ipv4.method manual ipv4.addresses “192.168.55.71/24” ipv4.gateway “192.168.55.1” ipv4.dns “8.8.8.8” ipv6.method manual ipv6.addresses “2002:fe60:def0::55/64”
nmcli con down enp0s8
nmcli con up enp0s8
nmcli general hostname rhcsa9-server1
~~~
Check to make sure everything is goodnmcli con show enp0s8
Enable key-based ssh authentication for root on both servers.
On server1:
~~~
ssh-keygen
ssh-copy-id root@192.168.55.72
scp /root/.ssh/* root@192.168.55.72:/root/.ssh
~~~
On server2:ssh-copy-id root@192.168.55.71
Set the password on all of the newly created users to dbapass
for user in manny moe jack marcia jan cindy; do echo "dbapass" | passwd --stdin $user; done
Create sudo command alias for MESSAGES with the command /bin/tail -f /var/log/messages
visudo
MESSAGESCmnd_Alias MESSAGES = /bin/tail -f /var/log/messages
Find all files larger than 3MB in the /etc directory on server1 and copy them to /largefiles
mkdir /largefiles find /etc -type f -size +3M -exec cp {} /largefiles \; 2>/dev/null ls -al /largefiles/
Put SELinux on server2 in permissive mode.
vi /etc/selinux/config
Change the following line:SELINUX=permissive
create swap partition and mount it persitently
fdisk /dev/sdb n p [enter] \+1G t # change type 2 # partition 2 swap w free -m mkswap /dev/sdb2 vim /etc/fstab /dev/sdb2 swap swap defaults 0 0 swapon -va free -m
Find all files that have the SUID permission set, and write the result to the file /root/suidfiles
find / -type f -perm /4000 > /root/suidfiles
special permissions
**SUID 4 u+s ** User executes file with permissions of file owner.
SGID 2 g+s User executes file with permissions of group owner. Files created in directory get the same group owner.
**Sticky bit 1 +t **No meaning. Prevents users from deleting files from other users.
Logical Volume Management
-
pvs
- List physical volumes -
pvcreate
- Create physical volume -
vgs
- List volume groups -
vgcreate
- Create volume group -
lvs
- List logical volumes -
lvcreate
- Create logical volume-
lvcreate -l 100%FREE -n database1 db_storage
creates a logical volume called database1 under the volume group db_storage
-
Creating LVM Logical Volumes
- first have to convert physical devices, such as disks or partitions, into physical volumes (PVs)
- create the volume group (VG) and assign PVs to it
- create the logical volume (LV) itself
Add a 10-GiB disk to your virtual machine. On this disk, create a Stratis pool and volume. Use the name stratisvol for the volume, and mount it persistently on the directory /stratis.
-
dnf install stratisd stratis-cli
to install all the required packages. - Type
systemctl enable --now stratisd
to enable the Stratis daemon. - Type
stratis pool create mypool /dev/sdc
to add the entire disk /dev/sdc to the storage pool. - Type
stratis pool list
to verify successful creation of the pool. - Type
stratis fs create mypool stratis1
to create the first Stratis file system. Note that you don’t have to specify a file system size. - Type
stratis fs list
to verify the creation of the file system. - Type
mkdir /stratis
to create a mount point for the Stratis file system. - Type
stratis fs list
to find the Stratis volume UUID. - Add the following line to /etc/fstab to enable the volume to be mounted automatically. Make sure to use the UUID name that is used by your Stratis file system.
UUID=xxx /stratis xfs defaults,x-systemd.requires=stratisd.service 0 0
- Type
mount -a
to mount the Stratis volume. Use the mount command to verify that this procedure worked successfully.
Create a configuration that allows user laura to run all administrative commands using sudo
sudo visudo -f /etc/sudoers.d/laura laura ALL=(ALL) ALL
Create a directory with the name /users and ensure it contains the subdirectories linda and anna. Export this directory by using an NFS server
dnf install -y nfs-utils mkdir -p /users/{linda,anna} chown -R nfsnobody:nfsnobody /users chmod -R 755 /users man exports and search EXAMPLE vim /etc/exports /users *(rw,sync,no_root_squash) systemctl enable --now nfs-server firewall-cmd --add-service nfs --permanent firewall-cmd --add-service rpc-bind --permanent firewall-cmd --add-service mountd --permanent firewall-cmd --reload firewall-cmd --list-all showmount -e localhost # verify the export
create user craig with no login shell
useradd craig -s /sbin/nologin
/var/fstab
user natasha should have read and write access
group Mac shoud have no access
setfacl -m u:natasha:rw- /var/fstab setfacl -m g:Mac:--- /var/fstab getfacl /var/fstab
get default boot target
CLI-only boot environment
systemctl get-default
multi-user.target
break into machine
e to get grub menu init=/bin/bash at end of line mount -o remount,rw / passwd root touch /.autorelabel exec /usr/lib/systemd/systemd
generate ssh key and copy to another server
ssh-keygen ssh-copy-id user@server
Documentation Commands
mandb # update man man man -k info /usr/share/doc