Advertisement
sandervanvugt

RHCSA may23

May 26th, 2023
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.17 KB | None | 0 0
  1. [root@server ~]# history
  2. 1 tar czvf /root/archive.tgz /etc
  3. 2 history
  4. 3 cat /etc/dnsmasq.conf
  5. 4 cat /etc/dnsmasq.conf | grep -v '^$'
  6. 5 cat /etc/dnsmasq.conf | grep -v '^$' | sort
  7. 6 cat /etc/dnsmasq.conf | grep -v '^$' | sort > /var/tmp/dnslines.txt
  8. 7 useradd bob
  9. 8 find / -user bob
  10. 9 mkdir /root/userfiles ; find / -user bob -exec cp -ra {} /root/userfiles \;
  11. 10 ls -l /root/userfiles/
  12. 11 history
  13. 12 visudo
  14. 13 /home/student/countdown 12
  15. 14 tail -1 /etc/passwd
  16. 15 visudo
  17. 16 su - bob
  18. 17 echo password | passwd --stdin bob
  19. 18 su - bob
  20. 19 visudo
  21. 20 su - bob
  22. 21 vim /etc/login.defs
  23. 22 cd /etc/skel/
  24. 23 ls
  25. 24 ls -a
  26. 25 touch hello
  27. 26 less /etc/passwd
  28. 27 id bob
  29. 28 groupadd sales
  30. 29 usermod -aG sales bob
  31. 30 id bob
  32. 31 su - bob
  33. 32 lid wheel
  34. 33 lid --help
  35. 34 lid -g wheel
  36. 35 chage bob
  37. 36 cd
  38. 37 ln /home/student/countdown /usr/local/bin/countdown
  39. 38 ln /home/student/countdown /usr/local/sbin/countdown
  40. 39 countdown 7
  41. 40 vim /etc/login.defs
  42. 41 touch /etc/skel/newfile
  43. 42 groupadd profs
  44. 43 groupadd students
  45. 44 useradd -G profs anna
  46. 45 useradd -G profs anouk
  47. 46 useradd -G students linda
  48. 47 useradd -G students lisa
  49. 48 for i in anna anouk lisa linda; do echo password | passwd --stdin $i; done
  50. 49 history
  51. 50 countdown 12
  52. 51 cd /etc/ls -l
  53. 52 cd /etc
  54. 53 ls -l
  55. 54 cd
  56. 55 mkdir -p /data/profs /data/students
  57. 56 cd /data
  58. 57 ls -l
  59. 58 id
  60. 59 umask
  61. 60 chown :profs /data/profs
  62. 61 ls -l
  63. 62 chgrp students /data/students
  64. 63 ls -l
  65. 64 chmod 770 students
  66. 65 ls -l
  67. 66 chmod g+w,o-rx /data/profs
  68. 67 ls -l
  69. 68 su - anna
  70. 69 chmod g+s /data/profs
  71. 70 su - anna
  72. 71 su - anouk
  73. 72 chmod +t /data/profs
  74. 73 su - anouk
  75. 74 history
  76. 75 cd
  77. 76 pwd
  78. 77 touch removeme
  79. 78 chattr +i removeme
  80. 79 rm -f removeme
  81. 80 lsattr removeme
  82. 81 chattr -i removeme
  83. 82 rm -f removeme
  84. 83 countdown 7
  85. 84 history
  86. 85 poweroff
  87. 86 lsblk
  88. 87 countdown 12
  89. 88 vim /etc/profile
  90. 89 vim /etc/profile.d/
  91. 90 fdisk /dev/sda
  92. 91 lsblk
  93. 92 mkfs.xfs /dev/sda3
  94. 93 mount /dev/sda3 /mnt
  95. 94 lsblk
  96. 95 mount
  97. 96 mkdir /files
  98. 97 vim /etc/fstab
  99. 98 reboot
  100. 99 lsblk
  101. 100 fdisk /dev/sda
  102. 101 mkfs.ext4 /dev/sda6
  103. 102 mkfs.xfs /dev/sda5
  104. 103 mkdir /sda5 /sda6
  105. 104 vim /etc/fstab
  106. 105 mount -a
  107. 106 vim /etc/fstab
  108. 107 fdisk /dev/sda
  109. 108 reboot
  110. 109 touch abc
  111. 110 mount -o remount,rw /
  112. 111 lsblk
  113. 112 fdisk -l /dev/sda
  114. 113 blkid
  115. 114 cat /etc/fstab
  116. 115 cat /etc/fstab | grep sda5
  117. 116 blkid | grep sda5
  118. 117 blkid | grep sda5 | awk '{ print $2 }'
  119. 118 blkid | awk '{ print $2 }'
  120. 119 blkid | grep sda5 | awk '{ print $2 }'
  121. 120 blkid | grep sda5 | awk '{ print $2 }' >> /etc/fstab
  122. 121 blkid | awk '/sda5/ { print $2 }'
  123. 122 vim /etc/fstab
  124. 123 history
  125. 124 vim /etc/fstab
  126. 125 vim /etc/default/grub
  127. 126 grub2-mkconfig -o /boot/grub2/grub.cfg
  128. 127 reboot
  129. 128 vim /etc/fstab
  130. 129 lsblk
  131. 130 vim /etc/fstab
  132. 131 xfs_admin --help
  133. 132 xfs_admin -L cow /dev/sdb3
  134. 133 vim /etc/fstab
  135. 134 reboot
  136. 135 fdisk -l /dev/sdb
  137. 136 fdisk -l /dev/sda
  138. 137 mkfs.ext4 --help
  139. 138 cd /boot
  140. 139 umount /boot
  141. 140 lsof /boot
  142. 141 kill -9 6571
  143. 142 mount
  144. 143 lsblk
  145. 144 findmnt
  146. 145 man 5 fstab
  147. 146 cd
  148. 147 free -m
  149. 148 fdisk /dev/sda
  150. 149 cat /proc/partitions
  151. 150 lsblk
  152. 151 mkswap /dev/sda6
  153. 152 vim /etc/fstab
  154. 153 free -m
  155. 154 swapon -a
  156. 155 free -m
  157. 156 countdown 15
  158. 157 lsblk
  159. 158 mkdir -p /mounts/files
  160. 159 gdisk /dev/sdb
  161. 160 fdisk /dev/sdb
  162. 161 mkfs.ext4 /dev/sdb1
  163. 162 mkfs.xfs -L myxfs /dev/sdb5
  164. 163 blkid
  165. 164 vim /etc/fstab
  166. 165 mkswap /dev/sdb6
  167. 166 vim /etc/fstab
  168. 167 mount 0a
  169. 168 mount -a
  170. 169 vim /etc/fstab
  171. 170 mkdir /mounts/xfs
  172. 171 mount -a
  173. 172 swapon -a
  174. 173 reboot
  175. 174 df -h
  176. 175 cd /
  177. 176 dd if=/dev/sr0 of=/rhel9.iso bs=1M
  178. 177 mkdir /repo
  179. 178 cp /etc/fstab /etc/fstab.bak
  180. 179 echo "/rhel9.iso /repo iso9660 defaults 0 0" >> /etc/fstab
  181. 180 mount -a
  182. 181 lsblk
  183. 182 dd if=/dev/zero of=/dev/sdb bs=1M count=100
  184. 183 lsblk
  185. 184 vim /etc/fstab
  186. 185 dnf repolist
  187. 186 cd /etc/yum.repos.d/
  188. 187 ls
  189. 188 rm -f *
  190. 189 dnf repolist
  191. 190 history
  192. 191 dnf config-manager --add-repo="file:///repo/AppStream"
  193. 192 cat /etc/yum.repos.d/repo_AppStream.repo
  194. 193 ls /repo
  195. 194 dnf config-manager --add-repo="file:///repo/BaseOS"
  196. 195 dnf repolist
  197. 196 dnf search nmap
  198. 197 dnf install nmap
  199. 198 vim repo_BaseOS.repo
  200. 199 vim repo_AppStream.repo
  201. 200 dnf install nmap
  202. 201 vim repo_AppStream.repo
  203. 202 cd
  204. 203 seinfo
  205. 204 dnf provides */Containerfile
  206. 205 dnf groups list
  207. 206 dnf groups install "Virtualization Host"
  208. 207 dnf groups list
  209. 208 dnf groups list hidden
  210. 209 cat /etc/redhat-release
  211. 210 dnf module list
  212. 211 countdown 15
  213. 212 history
  214. 213 dnf download htpd
  215. 214 dnf download httpd
  216. 215 ls
  217. 216 rpm -qp httpd-2.4.53-7.el9.x86_64.rpm --scripts
  218. 217 rpm -qf /etc/nsswitch.conf
  219. 218 rpm -qf /etc/passwd
  220. 219 rpm -ql setup
  221. 220 rpm -qd setup
  222. 221 history
  223. 222 cat /proc/partitions
  224. 223 reboot
  225. 224 cat /proc/partitions
  226. 225 gdisk /dev/sdb
  227. 226 pvcreate /dev/sdb1
  228. 227 xxd /dev/sdb1 | less
  229. 228 vgcreate vgdata /dev/sdb1
  230. 229 vgs
  231. 230 vgdisplay vgdata | less
  232. 231 echo $(( 255 * 4 ))
  233. 232 lvcreate -n lvdata -L 1G vgdata
  234. 233 lvcreate -n lvdata -l 100%FREE vgdata
  235. 234 mkfs.ext4 /dev/vgdata/lvdata
  236. 235 vim /etc/fstab
  237. 236 mkdir /lvdata
  238. 237 mount -a
  239. 238 mount
  240. 239 tail -1 /etc/fstab
  241. 240 ls -l /dev/mapper/vgdata-lvdata /dev/vgdata/lvdata
  242. 241 history
  243. 242 xxd /dev/sdb1 | less
  244. 243 vgs
  245. 244 vgextend vgdata /dev/sdb2
  246. 245 vgs
  247. 246 df -h
  248. 247 lvextend -l +50%FREE /dev/vgdata/lvdata
  249. 248 lvs
  250. 249 df -h
  251. 250 resize2fs /dev/vgdata/lvdata
  252. 251 df -h
  253. 252 countdown 15
  254. 253 ip a
  255. 254 systemctl status NetworkManager
  256. 255 nmtui
  257. 256 ip a
  258. 257 sysctl -a
  259. 258 sysctl -a | wc -l
  260. 259 dnf install -y tuned
  261. 260 systemctl enable --now tuned
  262. 261 tuned-adm list
  263. 262 echo vm.swappiness = 33 > /etc/sysctl.d/swappiness.conf
  264. 263 systctl -p /etc/sysctl.d/swappiness.conf
  265. 264 sysctl -p /etc/sysctl.d/swappiness.conf
  266. 265 sysctl -a | grep swappi
  267. 266 mkdir /etc/tuned/myprofile
  268. 267 cat >> /etc/tuned/myprofile/tuned.conf <<EOF
  269. 268 [sysctl]
  270. 269 vm.swappiness = 66
  271. 270 EOF
  272. 271 tuned-adm list
  273. 272 tuned-adm profile myprofile
  274. 273 tuned-adm profile
  275. 274 sysctl -a | grep swapp
  276. 275 vim /etc/tuned/tuned-main.conf
  277. 276 history
  278. 277 cat /lib/tuned/network-throughput/tuned.conf
  279. 278 ls /etc/tuned /usr/lib/tuned/
  280. 279 cd /
  281. 280 ls -l
  282. 281 history -w
  283. 282 cat /proc/partitions
  284. 283 gdisk /dev/sdb
  285. 284 pvcreate /dev/sdb1
  286. 285 xxd /dev/sdb1 | less
  287. 286 vgcreate vgdata /dev/sdb1
  288. 287 vgs
  289. 288 vgdisplay vgdata | less
  290. 289 echo $(( 255 * 4 ))
  291. 290 lvcreate -n lvdata -L 1G vgdata
  292. 291 lvcreate -n lvdata -l 100%FREE vgdata
  293. 292 mkfs.ext4 /dev/vgdata/lvdata
  294. 293 vim /etc/fstab
  295. 294 mkdir /lvdata
  296. 295 mount -a
  297. 296 mount
  298. 297 tail -1 /etc/fstab
  299. 298 ls -l /dev/mapper/vgdata-lvdata /dev/vgdata/lvdata
  300. 299 history
  301. 300 xxd /dev/sdb1 | less
  302. 301 vgs
  303. 302 vgextend vgdata /dev/sdb2
  304. 303 vgs
  305. 304 df -h
  306. 305 lvextend -l +50%FREE /dev/vgdata/lvdata
  307. 306 lvs
  308. 307 df -h
  309. 308 resize2fs /dev/vgdata/lvdata
  310. 309 df -h
  311. 310 countdown 15
  312. 311 ip a
  313. 312 systemctl status NetworkManager
  314. 313 nmtui
  315. 314 ip a
  316. 315 sysctl -a
  317. 316 sysctl -a | wc -l
  318. 317 dnf install -y tuned
  319. 318 systemctl enable --now tuned
  320. 319 tuned-adm list
  321. 320 echo vm.swappiness = 33 > /etc/sysctl.d/swappiness.conf
  322. 321 systctl -p /etc/sysctl.d/swappiness.conf
  323. 322 sysctl -p /etc/sysctl.d/swappiness.conf
  324. 323 sysctl -a | grep swappi
  325. 324 mkdir /etc/tuned/myprofile
  326. 325 cat >> /etc/tuned/myprofile/tuned.conf <<EOF
  327. 326 [sysctl]
  328. 327 vm.swappiness = 66
  329. 328 EOF
  330. 329 tuned-adm list
  331. 330 tuned-adm profile myprofile
  332. 331 tuned-adm profile
  333. 332 sysctl -a | grep swapp
  334. 333 vim /etc/tuned/tuned-main.conf
  335. 334 history
  336. 335 cat /lib/tuned/network-throughput/tuned.conf
  337. 336 ls /etc/tuned /usr/lib/tuned/
  338. 337 cd /
  339. 338 ls -l
  340. 339 history -w
  341. 340 reboot
  342. 341 history
  343. 342 systemctl -t help
  344. 343 systemctl list-units -t service
  345. 344 systemctl cat sshd.service
  346. 345 systemctl edit sshd.service
  347. 346 systemctl cat sshd.service
  348. 347 systemctl status sshd
  349. 348 systemctl stop sshd
  350. 349 systemctl status sshd
  351. 350 systemctl start sshd.service
  352. 351 systemctl status cups
  353. 352 dnf install vsftpd
  354. 353 systemctl status vsftpd
  355. 354 systemctl enable --now vsftpd
  356. 355 history
  357. 356 systemctl list-unit-files
  358. 357 #subscription-manager register
  359. 358 #subscription-manager attach
  360. 359 systemctl show sshd.service
  361. 360 dnf install httpd
  362. 361 systemctl list-unit-files | wc -l
  363. 362 systemctl list-units --all | wc -l
  364. 363 systemctl list-units --all
  365. 364 systemctl cat httpd.service
  366. 365 systemctl show httpd.service
  367. 366 systemctl edit httpd.service
  368. 367 systemctl daemon-reload
  369. 368 systemctl restart httpd
  370. 369 systemctl status httpd
  371. 370 kill -9 7369
  372. 371 systemctl status httpd
  373. 372 systemctl stop httpd
  374. 373 systemctl mask httpd
  375. 374 systemctl start httpd
  376. 375 systemctl unmask httpd
  377. 376 journalctl
  378. 377 journalctl -p err
  379. 378 journalctl -f
  380. 379 systemctl status rsyslog
  381. 380 cd /var/log
  382. 381 ls -lrt
  383. 382 vim /etc/rsyslog.conf
  384. 383 grep 'Storage' /etc/systemd/journald.conf
  385. 384 pwd
  386. 385 ls
  387. 386 mkdir /var/log/journal
  388. 387 ls /var/log/journal/
  389. 388 systemctl restart systemd-journal-flush.service
  390. 389 ls /var/log/journal/
  391. 390 systemctl cat httpd.service
  392. 391 man -k systemd
  393. 392 man -k systemd | wc -l
  394. 393 man systemd.directives
  395. 394 man systemd.service
  396. 395 history
  397. 396 systemctl stop httpd
  398. 397 systemctl disable httpd
  399. 398 systemctl cat httpd
  400. 399 systemctl status httpd
  401. 400 systemctl enable --now httpd
  402. 401 systemctl reboot
  403. 402 vim /etc/default/grub
  404. 403 grub2-mkconfig -o /boot/grub2/grub.cfg
  405. 404 cd /boot
  406. 405 ls
  407. 406 cd grub2/
  408. 407 ls
  409. 408 cd ..
  410. 409 find . -name "grub.cfg"
  411. 410 cd
  412. 411 systemctl get-default
  413. 412 systemctl set-default graphical.target
  414. 413 reboot
  415. 414 countdown 13
  416. 415 getenforce
  417. 416 setenforce permissive
  418. 417 getenforce
  419. 418 setenforce
  420. 419 setenforce enforcing
  421. 420 ps aux | grep http
  422. 421 ps Zaux | grep http
  423. 422 ls -Z /var/www
  424. 423 mkdir /web
  425. 424 vim /web/index.html
  426. 425 vim /etc/httpd/conf/httpd.conf
  427. 426 systemctl restart httpd
  428. 427 systemctl status httpd
  429. 428 curl http://localhost
  430. 429 getenforce
  431. 430 setenforce permissive
  432. 431 curl http://localhost
  433. 432 vim /etc/httpd/conf/httpd.conf
  434. 433 systemctl restart httpd
  435. 434 curl http://localhost
  436. 435 getenforxce
  437. 436 getenforce
  438. 437 setenforce enforcing
  439. 438 curl http://localhost
  440. 439 grep AVC /var/log/audit/audit.log
  441. 440 cd /var/www
  442. 441 ls -Z
  443. 442 ls -lZ /web
  444. 443 man semanage-fcontext
  445. 444 semanage fcontext -a -t httpd_sys_content_t "/web(/.*)?"
  446. 445 ls -Zd /web
  447. 446 restorecon -Rv /web
  448. 447 ls -Zd /web
  449. 448 getenforce
  450. 449 curl http://localhost
  451. 450 history
  452. 451 countdown 12
  453. 452 cd
  454. 453 ls -lZ /etc/hosts
  455. 454 cp /etc/hosts .
  456. 455 ls -Z hosts
  457. 456 mv hosts /tmp/hosts
  458. 457 ls -lZ /tmp/hosts
  459. 458 mv /tmp/hosts /web
  460. 459 ls -lZ /web
  461. 460 curl http://localhost/hosts
  462. 461 setenforce permissive
  463. 462 curl http://localhost/hosts
  464. 463 setenforce enforce
  465. 464 setenforce enforcing
  466. 465 grep AVC /var/log/audit/audit.log
  467. 466 ls -Z /web
  468. 467 ls -Zl /web
  469. 468 restorecon -Rv /web
  470. 469 journactl | grep sealert
  471. 470 journalctl | grep sealert
  472. 471 sealert -l 7bf77eae-01f9-466a-8051-1709a7e6f7d7 | less
  473. 472 journalctl | grep sealert
  474. 473 sealert -l a7307fae-0db9-4571-9337-63c0f9333d30 | less
  475. 474 semanage fcontext -l -C
  476. 475 dnf install -y selinux-policy-doc
  477. 476 man -k _selinux
  478. 477 man -k _selinux | wc -l
  479. 478 man httpd_selinux
  480. 479 vim /etc/ssh/sshd_config
  481. 480 systemctl restart sshd
  482. 481 systemctl status sshd
  483. 482 journalctl -xeu sshd.service
  484. 483 setenforce permissive
  485. 484 systemctl restart sshd
  486. 485 setenforce enforcing
  487. 486 journalctl | grep sealert
  488. 487 sealert -l fe2b0574-4fea-4ccb-aeed-7bd4b3109806 | less
  489. 488 semanage port -a -t ssh_port_t tpc 2022
  490. 489 man semanage-port
  491. 490 semanage port -a -t ssh_port_t -p tcp 2022
  492. 491 systemctl restart sshd
  493. 492 getsebool -a
  494. 493 getsebool -a | grep ftp
  495. 494 setsebool -P ftpd_anon_write on
  496. 495 getsebool -a | grep ftp
  497. 496 countdown 2
  498. 497 poweroff
  499. 498 password
  500. 499 vim /etc/hosts
  501. 500 ip a
  502. 501 vim /etc/httpd/conf/httpd.conf
  503. 502 lsblk
  504. 503 dnf install stratis-cli stratisd
  505. 504 systemctl enable --now stratisd
  506. 505 stratis --help
  507. 506 stratis pool create mypool /dev/sdc
  508. 507 stratis pool list
  509. 508 stratis blockdev list
  510. 509 stratis fs create mypool myfs
  511. 510 stratis fs list
  512. 511 stratis fs create mypool myfs2
  513. 512 stratis fs list
  514. 513 mkdir /myfs
  515. 514 lsblk --output=UUID
  516. 515 blkid
  517. 516 stratis fs list
  518. 517 vim /etc/fstab
  519. 518 reboot
  520. 519 podman ps
  521. 520 podman stop sleepy
  522. 521 podman images
  523. 522 podman run -d --name sleepy docker.io/redhat/ubi9 sleep 3600
  524. 523 podman rm sleepy
  525. 524 podman run -d --name sleepy docker.io/redhat/ubi9 sleep 3600
  526. 525 exit
  527. 526 ps faux | less
  528. 527 git clone https://github.com/sandervanvugt/rhcsa
  529. 528 cd rhcsa
  530. 529 ls
  531. 530 less mini-exam-30min.txt
  532. 531 exit
  533. 532 vim /etc/httpd/conf/httpd.conf
  534. 533 systemctl restart httpd
  535. 534 useradd --help | less
  536. 535 useradd -s /sbin/nologin lori
  537. 536 mkdir /txt
  538. 537 cd /etc/
  539. 538 grep -Rl 'strator'
  540. 539 grep -Rl 'strator' > /txt/stratorfiles.txt
  541. 540 cd
  542. 541 ln -s /etc/hosts /tmp/hosts
  543. 542 ls -l /tmp/hosts
  544. 543 mkdir -p /data/sales
  545. 544 groupadd sales
  546. 545 chgrp sales /data/sales
  547. 546 chmod 2770 /data/sales
  548. 547 cd /data/sales
  549. 548 touch testexam
  550. 549 ls -l
  551. 550 vgs
  552. 551 lvcreate -n testexam -l 50 vgdata
  553. 552 lvdisplay testexam
  554. 553 lvdisplay vgdata | less
  555. 554 tuned-adm --help | less
  556. 555 tuned-adm recommend
  557. 556 tuned-adm profile virtual-guest
  558. 557 cd
  559. 558 exit
  560. 559 grep AVC /var/log/audit/audit.log
  561. 560 getenforce
  562. 561 grep AVC /var/log/audit/audit.log
  563. 562 journalctl | grep sealert
  564. 563 sealert -l 8660260a-1e0f-4db7-87ac-29ccdaf8065a | less
  565. 564 semanage port -a -t http_port_t -p tcp 82
  566. 565 systemctl restart httpd
  567. 566 exit
  568. 567 history
  569.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement