Advertisement
sandervanvugt

RHCSA sept23 day3

Sep 20th, 2023
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.04 KB | None | 0 0
  1. 1 free -m
  2. 2 lscpu
  3. 3 df -h
  4. 4 lsblk
  5. 5 vim countdown
  6. 6 chmod +x countdown
  7. 7 ./countdown 14
  8. 8 ./countdown 14 lab
  9. 9 tar -czvf /root/archive.tgz /etc
  10. 10 ls -l
  11. 11 file archive.tgz
  12. 12 tar -tvf archive.tgz
  13. 13 tar -czvf /root/archive.tgz /etc/
  14. 14 tar -tvf archive.tgz
  15. 15 tar -czvf /root/archive.tgz /etc/*
  16. 16 tar -tvf archive.tgz
  17. 17 rm archive.tgz
  18. 18 tar -czvf /root/archive.tgz /etc/*
  19. 19 tar -tvf archive.tgz
  20. 20 cd /etc
  21. 21 tar -czvf /root/archive.tgz .
  22. 22 tar -tvf /root/archive.tgz
  23. 23 cd
  24. 24 rm archive.tgz
  25. 25 tar -czvf /root/archive.tgz -C /etc
  26. 26 tar -czvf /root/archive.tgz -C /etc .
  27. 27 history
  28. 28 grep -v '^$' /etc/dnsmasq.conf
  29. 29 grep -v '^$' /etc/dnsmasq.conf | sort
  30. 30 history
  31. 31 useradd bob
  32. 32 find / -type f -user bob
  33. 33 mkdir /root/userfiles ; find / -type f -user bob -exec cp {} /root/userfiles/ \;
  34. 34 history
  35. 35 mkdir /root/userfiles ; find / -type f -user bob -exec cp {} /root/userfiles/ \; 2> errors.txt
  36. 36 cat errors.txt
  37. 37 uname -r
  38. 38 visudo
  39. 39 useradd linda
  40. 40 echo password | passwd --stdin linda
  41. 41 visudo
  42. 42 which useradd
  43. 43 which userdel
  44. 44 which passwd
  45. 45 su - linda
  46. 46 visudo
  47. 47 su - linda
  48. 48 visudo
  49. 49 id student
  50. 50 exit
  51. 51 visudo
  52. 52 history
  53. 53 man -k sander
  54. 54 touch hello
  55. 55 locate hello
  56. 56 updatedb
  57. 57 locate hello
  58. 58 touch goedemiddag
  59. 59 locate goedemiddag
  60. 60 less /etc/passwd
  61. 61 vim /etc/login.defs
  62. 62 useradd --help | less
  63. 63 cd /etc/skel/
  64. 64 touch lijk
  65. 65 useradd anna
  66. 66 ls -al /home/anna
  67. 67 tail /etc/passwd
  68. 68 ls -l /etc/passwd
  69. 69 tail /etc/shadow
  70. 70 man 5 shadow
  71. 71 cd
  72. 72 grep anna /etc/passwd
  73. 73 grep 1004 /etc/group
  74. 74 groupadd profs
  75. 75 usermod -aG profs anna
  76. 76 grep anna /etc/passwd
  77. 77 grep anna /etc/group
  78. 78 id anna
  79. 79 lid -g wheel
  80. 80 history
  81. 81 vim /etc/login.defs
  82. 82 cd /etc/skel
  83. 83 touch newfile
  84. 84 groupadd profs
  85. 85 groupadd students
  86. 86 useradd -G profs anna
  87. 87 usermod -aG profs anna
  88. 88 usermod -aG profs linda
  89. 89 usermod -aG students lisa
  90. 90 usermod -aG students linda
  91. 91 useradd -G profs anouk
  92. 92 vim /etc/group
  93. 93 for i in anna anouk linda lisa; do echo password | passwd --stdin $i; done
  94. 94 history
  95. 95 su - linda
  96. 96 ls -l /tmp/linda1
  97. 97 id linda
  98. 98 su - linda
  99. 99 chmod 077 /tmp/linda1
  100. 100 su - linda
  101. 101 mkdir -p /data/specials
  102. 102 chgrp sales /data/specials
  103. 103 chgrp student /data/specials
  104. 104 ls -ld /data/specials/
  105. 105 chmod g+w /data/specials
  106. 106 chmod g-w /data/specials
  107. 107 mkdir /data/specials/dir{1-9}
  108. 108 touch /data/specials/file{1-9}
  109. 109 ls -l /data/specials/
  110. 110 touch /data/specials/file[1-9]
  111. 111 ls -l /data/specials/
  112. 112 cd /data/specials/*
  113. 113 rm -fr /data/specials/*
  114. 114 touch /data/specials/file{1..9}
  115. 115 mkdir /data/specials/dir{1..}
  116. 116 ls -l /data/specials/
  117. 117 mkdir /data/specials/dir{1..9}
  118. 118 ls -l /data/specials/
  119. 119 chgrp students /data/specials/ -R
  120. 120 ls -l /data/specials/
  121. 121 chmod -R +w /data/specials/
  122. 122 chmod -R -x /data/specials/
  123. 123 ls -l /data/specials/
  124. 124 chmod -R +x /data/specials/
  125. 125 ls -l /data/specials/
  126. 126 chmod -R -x /data/specials/
  127. 127 chmod -R +X /data/specials/
  128. 128 ls -l /data/specials/
  129. 129 mkdir -p /data/profs /data/students
  130. 130 ls -l /data/
  131. 131 chown :profs /data/profs
  132. 132 chgrp student /data/students
  133. 133 ls -l /data/
  134. 134 chmod 770 /data/*
  135. 135 ls -k
  136. 136 ls -l
  137. 137 ls -l /data
  138. 138 chmod g+w,o-rx /data/profs
  139. 139 cd
  140. 140 touch /home/linda/rootfile
  141. 141 su - linda
  142. 142 touch /home/linda/stuck
  143. 143 chattr +i /home/linda/stuck
  144. 144 rm -f /home/linda/stuck
  145. 145 chattr -i /home/linda/stuck
  146. 146 su - anna
  147. 147 chmod g+s /data/profs
  148. 148 ls -ld /data/profs
  149. 149 su - anna
  150. 150 su - anouk
  151. 151 chmod +t /data/profs
  152. 152 su - anouk
  153. 153 chmod o+x /data/profs
  154. 154 ls -ld /data/profs
  155. 155 history
  156. 156 umask
  157. 157 su - linda
  158. 158 su - lisa
  159. 159 cd /data
  160. 160 ls -,
  161. 161 ls -l
  162. 162 chmod 3770 *
  163. 163 ls -l
  164. 164 chattr +i students/
  165. 165 cd students/
  166. 166 ls
  167. 167 touch student1
  168. 168 echo hello > hello
  169. 169 exit
  170. 170 ./countdown 12
  171. 171 ./countdown 1
  172. 172 ./countdown 15
  173. 173 ./countdown 13
  174. 174 chattr -i /data/students/
  175. 175 poweroff
  176. 176 lsblk
  177. 177 fdisk /dev/sda
  178. 178 lsblk
  179. 179 mount /dev/sda3 /mnt
  180. 180 mkfs.ext4 /dev/sda3
  181. 181 mount /dev/sda3 /mnt
  182. 182 cd /mnt
  183. 183 ls
  184. 184 cp /etc/hosts .
  185. 185 history
  186. 186 cd
  187. 187 lsblk
  188. 188 mount
  189. 189 findmnt
  190. 190 lsblk
  191. 191 cd .mnt
  192. 192 cd /mnt
  193. 193 umount /dev/sda3
  194. 194 lsof /mnt
  195. 195 cd
  196. 196 fdisk /dev/sda
  197. 197 cat /proc/partitions
  198. 198 lsblk
  199. 199 mkfs.ext4 /dev/sda5
  200. 200 mkfs.xfs /dev/sda6
  201. 201 mkdir /ext4 /xfs
  202. 202 vim /etc/fstab
  203. 203 mount -a
  204. 204 mount
  205. 205 lsblk
  206. 206 reboot
  207. 207 lsblk
  208. 208 vim /etc/default/grub
  209. 209 grub2-mkconfig -o /boot/grub2/grub.cfg
  210. 210 vim /etc/default/grub
  211. 211 cat /etc/redhat-release
  212. 212 findmnt --help
  213. 213 cat /etc/redhat-release
  214. 214 man fstab
  215. 215 history
  216. 216 umount /dev/sda5
  217. 217 vim /etc/fstab
  218. 218 fdisk /dev/sda
  219. 219 reboot
  220. 220 lsblk
  221. 221 cat /etc/fstab
  222. 222 blkid
  223. 223 blkid | awk '/sda5/ { print $2 }'
  224. 224 blkid | awk '/sda5/ { print $2 }' >> /etc/fstab
  225. 225 vim /etc/fstab
  226. 226 reboot
  227. 227 history
  228. 228 tune2fs --help
  229. 229 mount | grep ext
  230. 230 xfs_admin --help
  231. 231 xfs_admin -L data /dev/sda5
  232. 232 umount /dev/sda5
  233. 233 xfs_admin -L data /dev/sda5
  234. 234 vim /etc/fstab
  235. 235 grep LABEL /etc/fstab
  236. 236 mount -a
  237. 237 blkid
  238. 238 free -m
  239. 239 reboot
  240. 240 free -m
  241. 241 grep -i active /proc/meminfo
  242. 242 free -m
  243. 243 fdisk /dev/sda
  244. 244 mkswap /dev/sda6
  245. 245 blkid
  246. 246 blkid | awk '/sda6/ { print $2 }'
  247. 247 blkid | awk '/sda6/ { print $2 }' >> /etc/fstab
  248. 248 vim /etc/fstab
  249. 249 free -m
  250. 250 swapon -a
  251. 251 free -m
  252. 252 reboot
  253. 253 fdisk -l /dev/sda
  254. 254 xxd -l 512 /dev/sda
  255. 255 history
  256. 256 dnf install nmap
  257. 257 ls -l $(which dnf) $(which yum)
  258. 258 df -h
  259. 259 dd if=/dev/sr0 of=/rhel9.iso bs=1M
  260. 260 mkdir /repo
  261. 261 echo "/rhel9.iso /repo iso9660 defaults 0 0" >> /etc/fstab
  262. 262 cat /etc/fstab
  263. 263 vim /etc/fstab
  264. 264 mount -a
  265. 265 mount
  266. 266 cd /repo
  267. 267 ls
  268. 268 ls BaseOS/
  269. 269 dnf config-manager --add-repo="file:///repo/BaseOS"
  270. 270 dnf config-manager --add-repo="file:///repo/AppStream"
  271. 271 dnf repolist
  272. 272 dnf search nmap
  273. 273 dnf install nmap
  274. 274 cd /etc/yum.repos.d/
  275. 275 ls
  276. 276 vim repo_BaseOS.repo
  277. 277 vim repo_AppStream.repo
  278. 278 dnf install nmap
  279. 279 history
  280. 280 dnf list selinux*
  281. 281 dnf provides */Containerfile
  282. 282 cd ..
  283. 283 dnf provides */dnsmasq.conf
  284. 284 seinfo
  285. 285 dnf groups list
  286. 286 dnf goups install "Virtualization Host"
  287. 287 dnf groups install "Virtualization Host"
  288. 288 cat yum.repos.d/repo_BaseOS.repo
  289. 289 systemctl enable --now tuned
  290. 290 systemctl status tuned
  291. 291 tuned-adm list
  292. 292 sysctl -a
  293. 293 sysctl -a | wc -l
  294. 294 sysctl -a | grep swappi
  295. 295 echo vm.swappiness = 33 > /etc/sysctl.d/swappiness.conf
  296. 296 sysctl -p /etc/sysctl.d/swappiness.conf
  297. 297 sysctl -a | grep swappi
  298. 298 mkdir /etc/tune/myprofile
  299. 299 mkdir /etc/tuned/myprofile
  300. 300 vim /etc/tuned/myprofile/tuned.conf
  301. 301 tuned-adm list
  302. 302 vim /usr/lib/tuned/latency-performance/tuned.conf
  303. 303 tuned-adm profile myprofile
  304. 304 sysctl -a | grep swapp
  305. 305 vim /etc/tuned/tuned-main.conf
  306. 306 tuned-adm list
  307. 307 systemctl status tuned
  308. 308 tuned-adm profile hpc-compute
  309. 309 tuned-adm list
  310. 310 history
  311. 311 cd
  312. 312 ip a
  313. 313 ping nu.nl
  314. 314 ip route show
  315. 315 cat /etc/resolv.conf
  316. 316 systemctl status NetworkManager
  317. 317 nmtui
  318. 318 ip a
  319. 319 ping nu.nl
  320. 320 man nmcli-examples
  321. 321 dnf install -y git
  322. 322 git clone https://github.com/sandervanvugt/rhcsa
  323. 323 cd rhcsa
  324. 324 ls
  325. 325 cat resources.txt
  326. 326 reboot
  327. 327 hwclock
  328. 328 date
  329. 329 hwclock --systohc
  330. 330 date -s 17:46
  331. 331 timedatectl set-time -h
  332. 332 systemctl status chronyd.service
  333. 333 vim /etc/chrony.conf
  334. 334 systemctl restart chronyd
  335. 335 chronyc sources
  336. 336 systemctl status firewalld
  337. 337 firewall-cmd --list-all
  338. 338 firewall-cmd --get-services
  339. 339 firewall-cmd --add-service sane
  340. 340 firewall-cmd --list-all
  341. 341 firewall-cmd --add-service sane --permanent
  342. 342 history
  343. 343 systemctl -t help
  344. 344 systemctl list-unit-files
  345. 345 systemctl list-units
  346. 346 systemctl list-units -t socket
  347. 347 systemctl list-units -t service
  348. 348 systemctl status sshd
  349. 349 dnf install -y httpd
  350. 350 systemctl status httpd
  351. 351 systemctl start httpd
  352. 352 systemctl status httpd
  353. 353 systemctl enable httpd
  354. 354 systemcat httpd.service
  355. 355 systemctl cat httpd.service
  356. 356 systemctl show httpd.service
  357. 357 systemctl edit httpd.service
  358. 358 systemctl cat httpd.service
  359. 359 systemctl daemon-reload
  360. 360 systemctl restart httpd
  361. 361 killall httpd
  362. 362 systemctl status httpd
  363. 363 ls /etc/systemd/system/multi-user.target.wants/
  364. 364 systemctl disable --now httpd.service
  365. 365 ls /etc/systemd/system/multi-user.target.wants/
  366. 366 systemctl enable httpd.service
  367. 367 systemctl disable httpd.service
  368. 368 systemctl mask httpd.service
  369. 369 systemctl start httpd.service
  370. 370 systemctl unmask httpd.service
  371. 371 systemctl start httpd.service
  372. 372 journalctl
  373. 373 journalctl -p err
  374. 374 journalctl -f
  375. 375 journalctl -u sshd.service
  376. 376 journalctl -u sshd.service -p err
  377. 377 systemctl status rsyslog
  378. 378 vim /etc/rsyslog.conf
  379. 379 vim /etc/systemd/journald.conf
  380. 380 mkdir var/log/journal
  381. 381 mkdir /var/log/journal
  382. 382 ls /var/log
  383. 383 ls /var/log/journal/
  384. 384 systemctl restart systemd-journal-flush.service
  385. 385 ls /var/log/journal/
  386. 386 systemctl get-default
  387. 387 systemctl set-default multi-user.target
  388. 388 reboot
  389. 389 systemctl list-units
  390. 390 reboot
  391. 391 systemctl list-units
  392. 392 systemctl set-default graphical.target
  393. 393 systemctl start graphical.target
  394. 394 systemctl list-dependencies
  395. 395 mount | grep efi
  396. 396 systemctl cat httpd.service
  397. 397 history
  398. 398 poweroff
  399. 399 ./countdown 15
  400. 400 ./countdown 1
  401. 401 ./countdown 14
  402. 402 lsblk
  403. 403 fdisk /dev/nvme0n1
  404. 404 gdisk /dev/sda
  405. 405 lsblk
  406. 406 pvcreate /dev/nvme0n1p1
  407. 407 xxd /dev/nvme0n1p1 | less
  408. 408 vgcreate vgdata /dev/nvme0n1p1
  409. 409 vgdisplay vgdata
  410. 410 echo $(( 511 * 4 ))
  411. 411 vgs
  412. 412 lvcreate -n lvdata vgdata -L 2G
  413. 413 lvcreate -n lvdata vgdata -l 100%FREE
  414. 414 man lvcreate
  415. 415 blkid
  416. 416 mkfs.xfs /dev/vgdata/lvdata
  417. 417 mount /dev/vgdata/lvdata /mnt
  418. 418 mount
  419. 419 ls -l /dev/mapper/vgdata-lvdata /dev/vgdata/lvdata
  420. 420 vim /etc/fstab
  421. 421 mount -a
  422. 422 mkdir /lvdata
  423. 423 mount -a
  424. 424 touch /lvdata/twice
  425. 425 ls /mnt
  426. 426 umount /mnt
  427. 427 dd if=/dev/random of=/lvdata/bigfile bs=1M
  428. 428 df -h
  429. 429 lvs
  430. 430 vgs
  431. 431 vgextend vgdata /dev/nvme0n1p2
  432. 432 vgs
  433. 433 lvextend --help | less
  434. 434 lvextend /dev/vgdata/lvdata -r -l +50%FREE
  435. 435 df -h
  436. 436 vgs
  437. 437 man lvcreate
  438. 438 vgcreate vgno /dev/sdc1 /dev/sdc2 /dev/sdc3
  439. 439 history
  440. 440 getenforce
  441. 441 setenforce permissive
  442. 442 getenforce
  443. 443 setenforce enforcing
  444. 444 ls -lZ /etc
  445. 445 ps Zaux | grep http
  446. 446 systemctl enable --now httpd
  447. 447 ps Zaux | grep http
  448. 448 ls -Z /var/www
  449. 449 ls -Zd /var/tmp
  450. 450 history
  451. 451 ls -lZ /etc
  452. 452 vim /etc/httpd/conf/httpd.conf
  453. 453 mkdir /web
  454. 454 echo hello world > /web/index.html
  455. 455 systemctl restart httpd
  456. 456 curl localhost
  457. 457 getenforce
  458. 458 setenforce permissive
  459. 459 curl localhost
  460. 460 grep AVC /var/log/audit/audit.log
  461. 461 ls -Z /var/www
  462. 462 man semanage-fcontext
  463. 463 # semanage fcontext -a -t httpd_sys_content_t "/web(/.*)?"
  464. 464 # restorecon -R -v /web
  465. 465 semanage fcontext -a -t httpd_sys_content_t "/web(/.*)?"
  466. 466 ls -Zd /web
  467. 467 restorecon -Rv /web
  468. 468 getenforce
  469. 469 setenforce enforcing
  470. 470 getenforce
  471. 471 curl localhost
  472. 472 history
  473. 473 man -k _selinux
  474. 474 dnf list selinux*
  475. 475 dnf install selinux-policy-doc
  476. 476 man -k _selinux
  477. 477 man -k _selinux | wc -l
  478. 478 man -k _selinux | grep http
  479. 479 man httpd_selinux
  480. 480 ls -Z /etc/hosts
  481. 481 cp /etc/hosts .
  482. 482 ls -Z /etc/hosts hosts
  483. 483 rm /etc/hosts
  484. 484 mv hosts /etc/
  485. 485 ls -Z /etc/hosts
  486. 486 restorecon -v /etc/hosts
  487. 487 vim /etc/httpd/conf/httpd.conf
  488. 488 systemctl restart httpd
  489. 489 systemctl status httpd
  490. 490 setenforce permissive
  491. 491 systemctl restart httpd
  492. 492 grep AVC /var/log/audit/audit.log
  493. 493 journalctl | grep sealert
  494. 494 sealert -l 85bc3c26-5dde-4ad3-9ccc-75a0e318ea45 | less
  495. 495 # semanage port -a -t PORT_TYPE -p tcp 82
  496. 496 semanage port -a -t http_port_t -p tcp 82
  497. 497 setenforce enforcing
  498. 498 systemctl restart httpd
  499. 499 man semanage-port
  500. 500 journalctl | grep sealert
  501. 501 sealert -l d8aed78c-3297-47b7-99eb-7d1a768f880d | less
  502. 502 semanage port -l
  503. 503 semanage port -l | grep http
  504. 504 semanage port -l | grep 80
  505. 505 man httpd_selinux
  506. 506 vim /usr/lib/firewalld/services/http.xml
  507. 507 vim /usr/lib/firewalld/services/ftp.xml
  508. 508 vim /usr/lib/firewalld/services/http.xml
  509. 509 getsebool -a
  510. 510 getsebool -a | wc -l
  511. 511 semanage fcontext -l | wc -l
  512. 512 getsebool -a | grep ftp
  513. 513 setsebool -P ftpd_anon_write on
  514. 514 reboot
  515. 515 history
  516.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement