Advertisement
sandervanvugt

RHCSA day3 may23

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