Advertisement
sandervanvugt

RHCSA day3 july22

Jul 20th, 2022
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.72 KB | None | 0 0
  1. [root@localhost ~]# history
  2. 1 vim countdown
  3. 2 chmod +x countdown
  4. 3 ./countdown 14
  5. 4 vim countdown
  6. 5 ./countdown 14
  7. 6 tar -czf /root/archive.tgz /etc
  8. 7 ls -l archive.tgz
  9. 8 file archive.tgz
  10. 9 tar tvf archive.tgz
  11. 10 history
  12. 11 grep -v '^$' /etc/dnsmasq.conf | sort > /var/tmp/dnslines.txt
  13. 12 echo $USER
  14. 13 useradd bob
  15. 14 find / -user bob
  16. 15 mkdir /root/userfiles ; find / -user bob -exec cp {} /root/userfiles/ \;
  17. 16 find / -user bob
  18. 17 find / -user bob -t file
  19. 18 find / -user bob
  20. 19 find / -user bob -type f
  21. 20 visudo
  22. 21 useradd lisa
  23. 22 passwd lisa
  24. 23 visudo
  25. 24 su - lisa
  26. 25 visudo
  27. 26 su - lisa
  28. 27 ls -ld /etc/sudoers.d/
  29. 28 ls -l /etc/sudoers.d/
  30. 29 vim /etc/sudoers.d/bob
  31. 30 visudo
  32. 31 man visudo
  33. 32 visudo
  34. 33 ./countdown 12
  35. 34 tail /etc/shadow
  36. 35 usermod -L bob
  37. 36 tail /etc/shadow
  38. 37 passwd --help
  39. 38 passwd -u bob
  40. 39 tail /etc/shadow
  41. 40 vim /etc/passwd
  42. 41 vim /etc/login.defs
  43. 42 echo $(( 99999 / 365 ))
  44. 43 vim /etc/login.defs
  45. 44 useradd --help | less
  46. 45 groupadd sales
  47. 46 usermod -aG sales student
  48. 47 exit
  49. 48 lid -g wheel
  50. 49 lid sales
  51. 50 lid -g sales
  52. 51 chage bob
  53. 52 vim /etc/login.defs
  54. 53 cd /etc/skel/
  55. 54 ls -a
  56. 55 echo hidem > .hiddenfile
  57. 56 echo hello > hellofile
  58. 57 ls -a
  59. 58 for i in anna anouk linda lisa; do useradd $i; done
  60. 59 tail /etc/shadow
  61. 60 usermod --help
  62. 61 usermod -s /sbin/nologin linda
  63. 62 usermod -s /sbin/nologin lisa
  64. 63 groupadd students
  65. 64 groupadd profs
  66. 65 usermod -aG profs anna
  67. 66 usermod -aG profs anouk
  68. 67 id anna
  69. 68 usermod -aG wheel anna
  70. 69 id anna
  71. 70 usermod -G wheel anna
  72. 71 id anna
  73. 72 history
  74. 73 usermod -s /bin/bash linda
  75. 74 usermod -s /bin/bash lisa
  76. 75 usermod -aG students linda
  77. 76 usermod -aG students lisa
  78. 77 cd
  79. 78 ./countdown 12
  80. 79 tail /etc/group
  81. 80 usermod -aG profs anna
  82. 81 tail /etc/group
  83. 82 cd
  84. 83 mkdir /data/profs /data/students
  85. 84 mkdir -p /data/profs /data/students
  86. 85 cd /data
  87. 86 ls -l
  88. 87 chown anna:profs profs
  89. 88 chgrp student students/
  90. 89 ls -l
  91. 90 chmod 770 profs
  92. 91 ls -l
  93. 92 chmod g+w,o-rx students/
  94. 93 ls -l
  95. 94 cd
  96. 95 chmod -x countdown
  97. 96 cat countdown
  98. 97 ./countdown
  99. 98 ls -l countdown
  100. 99 chmod +x countdown
  101. 100 ls -l countdown
  102. 101 history
  103. 102 cd /data/profs/
  104. 103 su - anna
  105. 104 chmod g+s .
  106. 105 ls -ld .
  107. 106 su - anna
  108. 107 su - anouk
  109. 108 chmod +t .
  110. 109 ls -ld .
  111. 110 su - anouk
  112. 111 su - anna
  113. 112 history
  114. 113 cd
  115. 114 cd /home/linda
  116. 115 touch rootfile
  117. 116 ls -l
  118. 117 su - linda
  119. 118 umask
  120. 119 vim /etc/bashrc
  121. 120 pwd
  122. 121 vim .bashrc
  123. 122 ls -a
  124. 123 vim .bash_profile
  125. 124 cd
  126. 125 lsblk
  127. 126 poweroff
  128. 127 lsblk
  129. 128 cat /proc/partitions
  130. 129 ./countdown 12
  131. 130 lsblk
  132. 131 fdisk /dev/sda
  133. 132 lsblk
  134. 133 mkfs.xfs /dev/sda3
  135. 134 mount /dev/sda3 /mnt
  136. 135 lsblk
  137. 136 mount
  138. 137 df -h
  139. 138 cd /mnt
  140. 139 touch hellofile
  141. 140 umount /mnt
  142. 141 lsof /mnt
  143. 142 cd
  144. 143 umount /mnt
  145. 144 mount /dev/sda3 /mnt
  146. 145 mount
  147. 146 mount | grep '^/'
  148. 147 mkdir /mountpoint
  149. 148 vim /etc/fstab
  150. 149 mount -a
  151. 150 findmnt --verify
  152. 151 reboot
  153. 152 fdisk /dev/sda
  154. 153 lsblk
  155. 154 mkdir /ext4 /xfs
  156. 155 mkfs.ext4 /dev/sda5
  157. 156 mkfs.xfs /dev/sda6
  158. 157 vim /etc/fstab
  159. 158 fdisk /dev/sda
  160. 159 reboot
  161. 160 cat /etc/fstab
  162. 161 lsblk
  163. 162 blkid
  164. 163 blkid | grep sda5 | awk '{ print $2 }'
  165. 164 blkid | grep sda5 | awk '{ print $2 }' >> /etc/fstab
  166. 165 vim fstab
  167. 166 vim /etc/fstab
  168. 167 reboot
  169. 168 history
  170. 169 cat /etc/fstab
  171. 170 blkid
  172. 171 mount | grep '^/'
  173. 172 xfs_admin --help
  174. 173 xfs_admin -L koeien /dev/sda5
  175. 174 umount /dev/sda5
  176. 175 xfs_admin -L koeien /dev/sda5
  177. 176 vim /etc/fstab
  178. 177 lsblk
  179. 178 fdisk /dev/sda
  180. 179 mkswap /dev/sda6
  181. 180 vim /etc/fstab
  182. 181 free -m
  183. 182 swapon -a
  184. 183 free -m
  185. 184 history
  186. 185 swapon -s
  187. 186 fdisk /dev/sda
  188. 187 reboot
  189. 188 ./countdown 1
  190. 189 ./countdown 13
  191. 190 ./countdown 12
  192. 191 lsblk
  193. 192 fdisk -l /dev/sda
  194. 193 echo $(( 62914559 - 54530047 ))
  195. 194 echo $(( 8384512 / 2 ))
  196. 195 df -h
  197. 196 ls
  198. 197 vim /etc/systemd/system/stress1.service
  199. 198 cp /etc/systemd/system/stress1.service /etc/systemd/system/stress2.service
  200. 199 systemctl daemon-reload
  201. 200 systemctl start stress1.service
  202. 201 systemctl start stress2.service
  203. 202 top
  204. 203 echo 0 > /sys/bus/cpu/devices/cpu1/online
  205. 204 top
  206. 205 nice --help
  207. 206 nice -n 10 dd if=/dev/zero of=/dev/null
  208. 207 nice -n 10 dd if=/dev/zero of=/dev/null &
  209. 208 nice -n -5 dd if=/dev/zero of=/dev/null &
  210. 209 top
  211. 210 history
  212. 211 sysctl -a
  213. 212 sysctl -a | wc
  214. 213 systemctl status tuned
  215. 214 ip a
  216. 215 ip addr add dev ens160 10.0.0.24/16
  217. 216 ip a
  218. 217 ifconfig
  219. 218 man ifconfig
  220. 219 ip route show
  221. 220 nmtui
  222. 221 ip a
  223. 222 ping nu.nl
  224. 223 ./countdown 12
  225. 224 vim /etc/bashrc
  226. 225 rpm -qa
  227. 226 rpm -qf /etc/dnsmasq.conf
  228. 227 rpm -qc dnsmasq
  229. 228 df -h
  230. 229 dd if=/dev/sr0 of=/rhel9.iso bs=1M
  231. 230 mkdir /repo
  232. 231 echo "/rhel9.iso /repo iso9660 defaults 0 0" >> /etc/fstab
  233. 232 mount -a
  234. 233 ls /repo
  235. 234 cd /repo/BaseOS/
  236. 235 ls
  237. 236 ls Packages/
  238. 237 ls
  239. 238 ls repodata/
  240. 239 cd ../AppStream/
  241. 240 ls
  242. 241 cd
  243. 242 cd /etc/yum.repos.d/
  244. 243 ls
  245. 244 vim baseos.repo
  246. 245 dnf repolist
  247. 246 vim appstream.repo
  248. 247 dnf repolist
  249. 248 vim appstream.repo
  250. 249 pwd
  251. 250 cat baseos.repo
  252. 251 cat appstream.repo
  253. 252 history | tail -15
  254. 253 vim baseos.repo
  255. 254 vim appstream.repo
  256. 255 dnf install nmap
  257. 256 vim appstream.repo
  258. 257 vim baseos.repo
  259. 258 dnf install tuned
  260. 259 ls *
  261. 260 ls
  262. 261 pwd
  263. 262 dnf list selinux*
  264. 263 dnf search seinfo
  265. 264 dnf search all seinfo
  266. 265 dnf provides */Containerfile
  267. 266 cd
  268. 267 dnf groups list
  269. 268 dnf group install "Virtualization Host"
  270. 269 dnf history
  271. 270 history
  272. 271 history | tail -30
  273. 272 history | tail -30 | head -25
  274. 273 cat /etc/yum.repos.d/baseos.repo
  275. 274 cat /etc/yum.repos.d/appstream.repo
  276. 275 systemctl -t help
  277. 276 systemctl list-units -t service
  278. 277 systemctl cat stress1.service
  279. 278 cd /etc/systemd/system/
  280. 279 cp stress1.service sleep.service
  281. 280 vim sleep.service
  282. 281 systemctl start sleep.service
  283. 282 systemctl status sleep.service
  284. 283 systemctl status sshd
  285. 284 dnf install httpd
  286. 285 ls -l $(which dnf) $(which yum)
  287. 286 systemctl status httpd
  288. 287 systemctl start httpd
  289. 288 systemctl status httpd
  290. 289 systemctl enable httpd
  291. 290 systemctl status httpd
  292. 291 systemctl cat sshd.service
  293. 292 systemctl cat httpd.service
  294. 293 systemctl edit httpd.service
  295. 294 export SYSTEMD_EDITOR=/usr/bin/vim
  296. 295 systemctl edit httpd.service
  297. 296 systemctl status httpd.service
  298. 297 systemctl daemon-reload
  299. 298 kill -9 38511
  300. 299 systemctl status httpd.service
  301. 300 vimtutor
  302. 301 vim .bashrc
  303. 302 ls -ld /etc/systemd/system /usr/lib/systemd/system
  304. 303 ls -ld /etc/tuned /usr/lib/tuned
  305. 304 systemctl show httpd.service
  306. 305 man systemd.directives
  307. 306 man systemd.unit
  308. 307 systemctl list-dependencies
  309. 308 history
  310. 309 systemctl mask httpd
  311. 310 systemctl status httpd
  312. 311 systemctl stop httpd
  313. 312 systemctl daemon-reload
  314. 313 systemctl stop httpd
  315. 314 systemctl unmask httpd
  316. 315 systemctl stop httpd
  317. 316 systemctl mask httpd
  318. 317 systemctl start httpd
  319. 318 history
  320. 319 journalctl
  321. 320 journalctl -o verbose
  322. 321 journalctl -xb
  323. 322 grep 'Storage=' /etc/systemd/journald.conf
  324. 323 mkdir /var/log/journal
  325. 324 systemctl list-unit-files journal*
  326. 325 systemctl list-unit-files journal
  327. 326 cd /var/log
  328. 327 mkdir journal
  329. 328 ls journal/
  330. 329 systemctl restart systemd-journal-flush.service
  331. 330 ls journal/
  332. 331 cd /etc/logrotate.d/
  333. 332 cd ..
  334. 333 vim logrotate.conf
  335. 334 cd
  336. 335 dnf install tuned
  337. 336 systemctl status tuned
  338. 337 systemctl start tuned
  339. 338 systemctl status tuned
  340. 339 tuned-adm list
  341. 340 tuned-adm pprofile balanced
  342. 341 tuned-adm profile balanced
  343. 342 tuned-adm list
  344. 343 vim /usr/lib/tuned/balanced/tuned.conf
  345. 344 tuned-adm profile virtual-guest
  346. 345 top
  347. 346 echo 1 > /sys/bus/cpu/devices/cpu1/online
  348. 347 top
  349. 348 lsblk
  350. 349 fdisk /dev/sda
  351. 350 pvcreate /dev/sda8
  352. 351 pvs
  353. 352 vgcreate vgdata /dev/sda8
  354. 353 pvs
  355. 354 vgs
  356. 355 lvcreate -n lvdata -L 500M vgdata
  357. 356 lvs
  358. 357 vgs
  359. 358 pvs
  360. 359 mkfs.ext4 /dev/vgdata/lvdata
  361. 360 vim /etc/fstab
  362. 361 mount -a
  363. 362 mkdir /lvdata
  364. 363 mount -a
  365. 364 mount
  366. 365 ls -l /dev/mapper/vgdata-lvdata /dev/vgdata/lvdata
  367. 366 history
  368. 367 vgs
  369. 368 vgdisplay
  370. 369 xxd /dev/sda8 | less
  371. 370 history
  372. 371 l
  373. 372 lsblk
  374. 373 fdisk /dev/nvme0n1
  375. 374 vgcreate vgfiles /dev/nvme0n1p1
  376. 375 lvcreate -l 255 -n lvfiles /dev/vgfiles
  377. 376 mkfs.ext4 /dev/vgfiles/lvfiles
  378. 377 df -h
  379. 378 lsblk
  380. 379 mount /dev/vgfiles/lvfiles /mnt
  381. 380 df -h
  382. 381 vgs
  383. 382 vgextend vgfiles /dev/nvme0n1p2
  384. 383 vgs
  385. 384 lvextend -r -l +50%FREE /dev/vgfiles/lvfiles
  386. 385 df -h
  387. 386 history
  388. 387 pvs
  389. 388 pvdisplay
  390. 389 echo $(( 255 * 4 ))
  391. 390 lvextend -r -l +100%FREE /dev/vgfiles/lvfiles
  392. 391 df -h
  393. 392 vgs
  394. 393 pvmove --help | less
  395. 394 man pvmove
  396. 395 pvmove /dev/nvme0n1p2
  397. 396 poweroff
  398. 397 fdisk /dev/sdb
  399. 398 lsblk
  400. 399 vgcreate vgdemo /dev/sdb1
  401. 400 lvcreate -L 1G -n lvdemo /dev/vgdemo
  402. 401 vgextend vgdemo /dev/sdb2
  403. 402 pvs
  404. 403 lvextend -L +500M /dev/vgdemo/lvdemo /dev/sdb2
  405. 404 pvs
  406. 405 mkfs.ext4 /dev/vgdemo/lvdemo
  407. 406 umount /mnt; mount /dev/vgdemo/lvdemo /mnt
  408. 407 df -h
  409. 408 dd if=/dev/zero of=/mnt/bigfile bs=1M count=1100
  410. 409 pvmove -v /dev/sdb2 /dev/sdb1
  411. 410 pvs
  412. 411 vgreduce vgdemo /dev/sdb2
  413. 412 history
  414. 413 vgdisplay vgfiles
  415. 414 history
  416. 415 dnf install stratis-cli stratisd
  417. 416 systemctl enable --now stratisd
  418. 417 fdisk /dev/sdb
  419. 418 stratis pool create mypool /dev/sdb3
  420. 419 stratis pool list
  421. 420 stratis pool add-data /dev/sdb4
  422. 421 stratis pool add-data mypool /dev/sdb4
  423. 422 stratis blockdev list
  424. 423 stratis fs create mypool myfs1
  425. 424 stratis fs list
  426. 425 stratis pool list
  427. 426 mkdir /myfs
  428. 427 lsblk --output=UUID /dev/stratis/mypool/myfs1
  429. 428 lsblk /dev/stratis/mypool/myfs1
  430. 429 blkid
  431. 430 stratis fs list
  432. 431 stratis fs list | awk '{ $NF }'
  433. 432 stratis fs list | awk '{ print $NF }'
  434. 433 stratis fs list | awk '{ print $NF }' | tail -n 1
  435. 434 stratis fs list | awk '{ print $NF }' | tail -n 1 >> /etc/fstab
  436. 435 vim /etc/fstab
  437. 436 mkdir /myfs
  438. 437 mount -a
  439. 438 mount
  440. 439 stratis fs list
  441. 440 df -h
  442. 441 ./countdown 13
  443. 442 systemctl list-depedendencies
  444. 443 systemctl list-units
  445. 444 reboot
  446. 445 mount
  447. 446 df -h
  448. 447 touch aa
  449. 448 mount -o remount,rw /
  450. 449 systemctl list-units
  451. 450 reboot
  452. 451 systemctl list-units
  453. 452 passwd
  454. 453 systemctl start graphical.target
  455. 454 vim /etc/default/grub
  456. 455 grub2-mkconfig -o /boot/grub2/grub.cfg
  457. 456 systemctl list-units -t target
  458. 457 systemctl list-unit-files -t target
  459. 458 systemctl cat sound.target
  460. 459 systemctl cat graphical.target
  461. 460 systemctl get-default
  462. 461 systemctl isolate multi-user.target
  463. 462 systemctl start graphical.target
  464. 463 vim /etc/fstab
  465. 464 cd /run/systemd/generator/
  466. 465 ls
  467. 466 vim mountpoint.mount
  468. 467 cp mountpoint.mount /etc/systemd/system/
  469. 468 vim /etc/fstab
  470. 469 systemctl daemon-reload
  471. 470 systemctl enable mountpoint.mount
  472. 471 systemctl cat sshd.service
  473. 472 vim /etc/systemd/system/mountpoint.mount
  474. 473 systemctl daemon-reload
  475. 474 systemctl enable mountpoint.mount
  476. 475 systemctl status mountpoint.mount
  477. 476 ls
  478. 477 pwd
  479. 478 cd ..
  480. 479 cd generator/
  481. 480 ls
  482. 481 cat /etc/fstab
  483. 482 vim myfs.mount
  484. 483 cd /dev/disk/
  485. 484 tree
  486. 485 blkid
  487. 486 vim myfs.mount
  488. 487 cd /run/systemd/generator/
  489. 488 vim myfs.mount
  490. 489 cp myfs.mount /etc/systemd/system
  491. 490 vim /etc/fstab
  492. 491 vim /etc/systemd/system/myfs.mount
  493. 492 reboot
  494. 493 systemctl status myfs.mount
  495. 494 systemctl enable myfs.mount
  496. 495 reboot
  497. 496 systemctl cat tmp.mount
  498. 497 ls -l /tmp; systemctl enable --now tmp.mount
  499. 498 ls -l /tmp
  500. 499 systemctl disable --now tmp.mount
  501. 500 history
  502. 501 getenforce
  503. 502 setenforce
  504. 503 setenforce disabled
  505. 504 ls -Z /etc
  506. 505 dnf install -y httpd
  507. 506 ls -Z /var/www
  508. 507 ps Zaux | grep http
  509. 508 systemctl enable --now httpd
  510. 509 systemctl unmask httpd
  511. 510 systemctl enable --now httpd
  512. 511 ps Zaux | grep ttp
  513. 512 vim /etc/httpd/conf/httpd.conf
  514. 513 mkdir /web
  515. 514 vim /web/index.html
  516. 515 systemctl restart httpd
  517. 516 curl localhost
  518. 517 getenforce
  519. 518 setenforce permissive
  520. 519 curl localhost
  521. 520 setenforce enforcing
  522. 521 vim /etc/httpd/conf/httpd.conf
  523. 522 systemctl restart httpd
  524. 523 curl localhost
  525. 524* setenforce permissive
  526. 525 curl localhost
  527. 526 setenforce enforcing
  528. 527 ps Zaux | grep http
  529. 528 ls -ldZ /web
  530. 529 grep AVC /var/log/audit/audit.log
  531. 530 history
  532. 531 ./countdown 12
  533. 532 getenforce
  534. 533 curl localhost
  535. 534 ls -dZ /web /var/www/html
  536. 535 man semanage-fcontext
  537. 536 semanage fcontext -a -t httpd_sys_content_t "/web(/.*)?"
  538. 537 ls -dZ /web /var/www/html
  539. 538 restorecon -Rv /web
  540. 539 curl localhost
  541. 540 cp /etc/hosts .
  542. 541 ls -Z /etc/hosts ./hosts
  543. 542 mv hosts /web/
  544. 543 ls -Z /web/hosts
  545. 544 curl http://localhost/hosts
  546. 545 ls -Z /web
  547. 546 restore -Rv /web
  548. 547 restorecon -Rv /web
  549. 548 dnf install -y selinux-policy-doc
  550. 549 man -k _selinux
  551. 550 man -k _selinux | wc
  552. 551 man -k _selinux | grep http
  553. 552 man -k _selinux
  554. 553 man httpd_selinux
  555. 554 man semanage-port
  556. 555 vim /etc/httpd/conf/httpd.conf
  557. 556 systemctl restart httpd
  558. 557 systemctl status httpd
  559. 558 systemctl stop
  560. 559 systemctl stop httpd
  561. 560 systemctl start httpd
  562. 561 systemctl status httpd
  563. 562 journalctl -u httpd
  564. 563 man semanage-port
  565. 564 semanage port -a -t http_port_t -p tcp 82
  566. 565 systemctl restart httpd
  567. 566 systemctl status httpd
  568. 567 semanage boolean -l -C
  569. 568 getsebool -a | grep ftp
  570. 569 setsebool -P ftpd_anon_write on
  571. 570 getsebool -a | grep ftp
  572. 571 dnf provides */sealart
  573. 572 dnf provides */sealert
  574. 573 journalctl | grep sealert
  575. 574 sealert -l d88f91a8-dc46-4a21-bc8f-be814360abb3 | less
  576. 575 journalctl | grep sealert
  577. 576 sealert -l d320c3e4-aa80-43fb-a4f4-1f22a0c604a0 | less
  578. 577 journalctl | grep sealert
  579. 578 journalctl | grep sealert | tail -1
  580. 579 journalctl | grep sealert | tail -1 | awk '{ print $NF }'
  581. 580 sealert -l $(journalctl | grep sealert | tail -1 | awk '{ print $NF }')
  582. 581 sealert -l $(journalctl | grep sealert | tail -1 | awk '{ print $NF }') | less
  583. 582 history
  584. 583 timedatectl show
  585. 584 timedatectl status
  586. 585 timedatectl ntp-servers -h
  587. 586 man timedatectl
  588. 587 systemctl status chrony
  589. 588 systemctl status chronyd.service
  590. 589 vim /etc/chrony.conf
  591. 590 systemctl restart chronyd.service
  592. 591 chronyc sources
  593. 592 history
  594.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement