Advertisement
sandervanvugt

RHCSA day4 nov 20

Nov 13th, 2020
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.96 KB | None | 0 0
  1. [sudo] password for student:
  2. [root@server1 ~]# history
  3. 1 vim /etc/login.defs
  4. 2 useradd linda -G students
  5. 3 useradd lisa -G students
  6. 4 useradd anna -G profs
  7. 5 useradd anouk -G profs
  8. 6 id anna
  9. 7 history
  10. 8 groupadd sales
  11. 9 groupadd account
  12. 10 usermod -aG sales linda
  13. 11 usermod -aG sales lisa
  14. 12 usermod -aG account anna
  15. 13 usermod -aG account anouk
  16. 14 mkdir -p /data/sales
  17. 15 mkdir -p /data/account
  18. 16 cd /data
  19. 17 ls -l
  20. 18 id
  21. 19 chgrp sales sales
  22. 20 chgrp account account
  23. 21 ls -l
  24. 22 chmod 770 *
  25. 23 ls -l
  26. 24 cd /home/linda
  27. 25 touch wortel
  28. 26 ls -l
  29. 27 su - linda
  30. 28 touch anotherwortel
  31. 29 pwd
  32. 30 su - linda
  33. 31 vim playme
  34. 32 chmod +x playme
  35. 33 su - linda
  36. 34 chmod u+s playme
  37. 35 vim playme
  38. 36 su - linda
  39. 37 find / -perm /4000 2>/dev/null
  40. 38 find / -perm /4000 -exec ls -l {} ]; 2>/dev/null
  41. 39 find / -perm /4000 -exec ls -l {} \; 2>/dev/null
  42. 40 ls -l /etc/shadow
  43. 41 less /etc/passwd
  44. 42 useradd myservice -u 2000 -s /sbin/nologin
  45. 43 su - linda
  46. 44 su - lisa
  47. 45 ls -ld .
  48. 46 cd /data/sales
  49. 47 ls -ld .
  50. 48 chmod g+s .
  51. 49 ls -ld .
  52. 50 su - lisa
  53. 51 chmod +t /data/sales
  54. 52 ls -ld /data/sales
  55. 53 su - lisa
  56. 54 cd ..
  57. 55 ls -l
  58. 56 su - anna
  59. 57 getfacl sales
  60. 58 setfacl -R -m g:account:rx /data/sales
  61. 59 cd /data/sales
  62. 60 ls -l
  63. 61 getfacl lisa1
  64. 62 man setfacl
  65. 63 cd ..
  66. 64 setfacl -x g:account sales
  67. 65 getfacls sales
  68. 66 getfacl sales
  69. 67 getfacl sales/linda2
  70. 68 setfacl -R -x g:account sales
  71. 69 getfacl sales/linda2
  72. 70 setfacl -R -m g:account:rX /data/sales
  73. 71 getfacl /data/sales/linda2
  74. 72 su - linda
  75. 73 setfacl -m d:g:account:rx /data/sales
  76. 74 getfacl /data/sales
  77. 75 exit
  78. 76 su - linda
  79. 77 ./countdown 12
  80. 78 lsblk
  81. 79 poweroff
  82. 80 lslbk
  83. 81 lsblk
  84. 82 fdisk /dev/sda
  85. 83 lslbk
  86. 84 alias lslbk=lsblk
  87. 85 lslbk
  88. 86 mkfs.xfs /dev/sda3
  89. 87 lsbk
  90. 88 lsblk
  91. 89 mkdir /partition
  92. 90 vim /etc/fstab
  93. 91 mount -a
  94. 92 mount
  95. 93 reboot
  96. 94 poweroff
  97. 95 fdisk /dev/sda
  98. 96 fdisk -l /dev/sda
  99. 97 cat /proc/partitions
  100. 98 lslbk
  101. 99 lsblk
  102. 100 reboot
  103. 101 lsblk
  104. 102 mkfs.ext4 /dev/sda6
  105. 103 mkdir /oldfiles
  106. 104 vim /etc/fstab
  107. 105 fdisk /dev/sda
  108. 106 reboot
  109. 107 vim /etc/fstab
  110. 108 reboot
  111. 109 history
  112. 110 vim /etc/fstab
  113. 111 reboot
  114. 112 journalctl -xb
  115. 113 mount
  116. 114 mount -a
  117. 115 fdisk /dev/sda
  118. 116 blkid
  119. 117 blkid | grep sda5 | cut -f 2
  120. 118 blkid | grep sda5 | awk '{ print $2 }'
  121. 119 blkid | grep sda5 | awk '{ print $2 }' >> /etc/fstab
  122. 120 vim /etc/fstab
  123. 121 exit
  124. 122 mount
  125. 123 fdisk /dev/sda
  126. 124 lsblk
  127. 125 mkfs.xfs --help
  128. 126 mkfs.xfs -L horse /dev/sda6
  129. 127 mkdir /horses
  130. 128 vim /etc/fstab
  131. 129 mount -a
  132. 130 xfs_admin --help
  133. 131 fdisk /dev/sda
  134. 132 reboot
  135. 133 cd /data
  136. 134 ls -l
  137. 135 mkdir students profs
  138. 136 cgrp students students
  139. 137 chgrp students students
  140. 138 chgrp profs profs
  141. 139 ls -l
  142. 140 chmod 770 profs
  143. 141 chmod 770 students
  144. 142 chmod 3770 [sp]*
  145. 143 ls -l
  146. 144 chown anna profs
  147. 145 chown anna students
  148. 146 setfacl -m -R g:profs:rX students
  149. 147 setfacl -R -m g:profs:rX students
  150. 148 setfacl -R -m d:g:profs:rx students
  151. 149 chown -R anna /data
  152. 150 cd /
  153. 151 dd if=/dev/sr0 of=/centos82.iso bs=1M
  154. 152 mkdir /repo
  155. 153 vim /etc/fstab
  156. 154 mount -a
  157. 155 ls /repo
  158. 156 cd /repo
  159. 157 ls BaseOS/
  160. 158 ls AppStream/
  161. 159 cd /etc/yum.repos.d/
  162. 160 ls
  163. 161 rm -f *
  164. 162 yum repolist
  165. 163 vim baseOS.repo
  166. 164 vim AppStream.repo
  167. 165 cat baseOS.repo
  168. 166 yum repolist
  169. 167 cd
  170. 168 cd /repo
  171. 169 ls
  172. 170 cd
  173. 171 ls
  174. 172 ./countdown 12
  175. 173 yum search nmap
  176. 174 cd /etc/yum.repos.d/
  177. 175 vim baseOS.repo
  178. 176 ls
  179. 177 vim AppStream.repo
  180. 178 yum search nmap
  181. 179 cd
  182. 180 yum search seinfo
  183. 181 yum provides */seinfo
  184. 182 yum install nmap
  185. 183 yum remove nmap
  186. 184 yum info nmap
  187. 185 man 5 yum.conf
  188. 186 yum modules list
  189. 187 yum module list
  190. 188 yum module info postgresql
  191. 189 yum module info --profile postgresql
  192. 190 yum module install postgresql:9.6
  193. 191 yum module install postgresql:9.6/devel
  194. 192 yum module install postgresql:9.6
  195. 193 yum install httpd
  196. 194 yum module info httpd
  197. 195 yum module enable postgresql:10
  198. 196 yum module info --profile php
  199. 197 yum module install php:7.2/devel
  200. 198 yum module reset php
  201. 199 yum module install --allowerasing php:7.3
  202. 200 history
  203. 201 ip a
  204. 202 ip -c -brie a
  205. 203 ip addr
  206. 204 ip route
  207. 205 ip addr add dev ens33 10.0.0.11/24
  208. 206 ping 10.0.0.11
  209. 207 ip a
  210. 208 man ifconfig
  211. 209 ifconfig
  212. 210 ifconfig -a
  213. 211 man ifconfig
  214. 212 ip route show
  215. 213 ip route del default via 192.168.4.2
  216. 214 ip r
  217. 215 ping nu.nl
  218. 216 ip route add default via 192.168.4.2
  219. 217 ping nu.nl
  220. 218 history
  221. 219 ./countdown 12
  222. 220 nmtui
  223. 221 ip a
  224. 222 nmtui
  225. 223 ip a
  226. 224 man nmcli-examples
  227. 225 nmcli connection modify ens33 ipv4.addresses +10.0.0.12/24
  228. 226 nmcli connection add ens33 ipv4.addresses +10.0.0.12/24
  229. 227 nmcli connection modify ens33 ipv4.addresses 192.168.4.188/24
  230. 228 nmcli connection up ens33
  231. 229 ip a
  232. 230 cd /etc/sysconfig/network-scripts/
  233. 231 ls
  234. 232 vim ifcfg-ens33
  235. 233 cd
  236. 234 systemctl status tuned
  237. 235 tuned-adm --help
  238. 236 tuned-adm list
  239. 237 tuned-adm recommend
  240. 238 tuned-adm profile desktop
  241. 239 tuned-adm list
  242. 240 cd /usr/lib/tuned/virtual-guest/
  243. 241 ls
  244. 242 vim tuned.conf
  245. 243 lspci
  246. 244 cd
  247. 245 fdisk /dev/sda
  248. 246 xxd /dev/sda7 | less
  249. 247 pvcreate /dev/sda7
  250. 248 pvs
  251. 249 xxd /dev/sda7 | less
  252. 250 vgcreate --help
  253. 251 vgcreate -s 16m vgdata /dev/sda7
  254. 252 vgs
  255. 253 vgdisplay vgdata
  256. 254 lvcreate -n lvdata -L 1G vgdata
  257. 255 echo $(( 63 * 4 ))
  258. 256 echo $(( 63 * 16 ))
  259. 257 echo $(( 66 * 16 ))
  260. 258 echo $(( 64 * 16 ))
  261. 259 lvcreate -n lvdata -l 63 vgdata
  262. 260 lvs
  263. 261 mkfs.ext3 /dev/vgdata/lvdata
  264. 262 vim /etc/fstab
  265. 263 mount -a
  266. 264 mkdir /lvdata
  267. 265 mount -a
  268. 266 df -h
  269. 267 ls -l /dev/mapper/vgdata-lvdata /dev/vgdata/lvdata
  270. 268 \ls -l /dev/mapper/vgdata-lvdata /dev/vgdata/lvdata
  271. 269 history
  272. 270 tail -1 /etc/fstab
  273. 271 alias
  274. 272 xxd /dev/sda7 | less
  275. 273 yum provides */lvcreate
  276. 274 ./countdown 12
  277. 275 vgs
  278. 276 vgextend --help | less
  279. 277 vgextend vgdata /dev/sda8
  280. 278 vgs
  281. 279 man lvresize
  282. 280 lvresize --help | less
  283. 281 df -h
  284. 282 lvresize -r -L +500M /dev/vgdata/lvdata
  285. 283 lvresize -l +100%FREE /dev/vgdata/lvdata
  286. 284 lvs
  287. 285 df -h
  288. 286 resize2fs /dev/mapper/vgdata-lvdata
  289. 287 df -h
  290. 288 history
  291. 289 free -m
  292. 290 fdisk /dev/sda
  293. 291 mkswap /dev/sda9
  294. 292 free -m
  295. 293 vim /etc/fstab
  296. 294 swapon -a
  297. 295 free -m
  298. 296 history
  299. 297 grep -i active /proc/meminfo
  300. 298 cd /proc
  301. 299 ls
  302. 300 mkswap --help
  303. 301 swapon -s
  304. 302 grep -i activ /proc/meminfo
  305. 303 cd
  306. 304 history
  307. 305 q
  308. 306 poweroff
  309. 307 lsblk
  310. 308 gdisk /dev/sdb
  311. 309 lsblk
  312. 310 yum install stratis-cli stratisd
  313. 311 systemctl enable --now stratisd
  314. 312 stratis pool create mypool /dev/sdb1
  315. 313 stratis pool list
  316. 314 stratis filesystem create mypool myfs1
  317. 315 stratis filesystem list mypool
  318. 316 stratis filesystem create mypool myfs2
  319. 317 stratis filesystem list mypool
  320. 318 lsblk
  321. 319 mkdir /myfs1 /myfs2
  322. 320 stratis filesystem list mypool
  323. 321 stratis filesystem list mypool | grep myfs1 | awk '{ print $9 }'
  324. 322 stratis filesystem list mypool | grep myfs1 | awk '{ print $10 }'
  325. 323 stratis filesystem list mypool | grep myfs1 | awk '{ print $10 }' >> /etc/fstab
  326. 324 stratis filesystem list mypool | grep myfs2 | awk '{ print $NF }'
  327. 325 stratis filesystem list mypool | grep myfs2 | awk '{ print $NF }' >> /etc/fstab
  328. 326 vim /etc/fstab
  329. 327 mount -a
  330. 328 blkid
  331. 329 lsblk -f
  332. 330 blkid | tail -3
  333. 331 blkid | tail -3 | head -1 | awk '{ print $2 }'
  334. 332 blkid | tail -3 | head -1 | awk '{ print $2 }' >> /etc/fstab
  335. 333 blkid | tail -2 | head -1 | awk '{ print $2 }' >> /etc/fstab
  336. 334 vim /etc/fstab
  337. 335 mount -a
  338. 336 df -h
  339. 337 stratis pool list
  340. 338 stratis blockdev list mypool
  341. 339 stratis pool add-data mypool /dev/sdb2
  342. 340 stratis pool list
  343. 341 reboot
  344. 342 vim /etc/default/grub
  345. 343 grub2-mkconfig -o /boot/grub2/grub.cfg
  346. 344 history | grep pool
  347. 345 yum install vdo kmod-kvdo
  348. 346 man vdo
  349. 347 # vdo create --name=vdo0 --device=/dev/sdb1 --vdoLogicalSize=10T
  350. 348 gdisk /dev/sdc
  351. 349 lsblk
  352. 350 # vdo create --name=vdo0 --device=/dev/sdb1 --vdoLogicalSize=10T
  353. 351 vdo create --name=vdofiles --device=/dev/sdc1 --vdoLogicalSize=10T
  354. 352 vim /etc/fstab
  355. 353 cd /run/systemd/generator/
  356. 354 ls
  357. 355 vim myfs1.mount
  358. 356 vim lvdata.mount
  359. 357 vim -- -.mount
  360. 358 cd /usr/lib/systemd/system
  361. 359 ls *mount
  362. 360 vim tmp.mount
  363. 361 mount | grep '/tmp'
  364. 362 systemctl enable --now tmp.mount
  365. 363 mount | grep '/tmp'
  366. 364 history
  367. 365 cd /usr/share/doc/vdo/examples/
  368. 366 ls
  369. 367 cd systemd/
  370. 368 ls
  371. 369 mkdir /vdofiles
  372. 370 cp VDO.mount.example /etc/systemd/system/vdofiles.mount
  373. 371 vim /etc/systemd/system/vdofiles.mount
  374. 372 mkfs.xfs -K /dev/mapper/vdofiles
  375. 373 systemctl enable --now vdofiles.mount
  376. 374 systemctl status vdofiles.mount
  377. 375 reboot
  378. 376 mount | grep vdo
  379. 377 ./countdown 12
  380. 378 man lvmvdo
  381. 379 cd /usr/share/doc/vdo/
  382. 380 ls
  383. 381 cd examples/
  384. 382 ls
  385. 383 cd systemd/
  386. 384 pwd
  387. 385 ls
  388. 386 cat VDO.mount.example
  389. 387 ls -ld /usr/lib/systemd/system/
  390. 388 ls -ld /etc/systemd/system/
  391. 389 cd /etc/systemd/system/
  392. 390 ls
  393. 391 vim vdofiles.mount
  394. 392 cd
  395. 393 yum install -y httpd
  396. 394 systemctl enable --now httpd
  397. 395 ps Zaux | grep http
  398. 396 netstat -Ztulpen
  399. 397 cd /var/www
  400. 398 ls -Z
  401. 399 cd /var/tmp
  402. 400 ls
  403. 401 ls -Zd .
  404. 402 cd
  405. 403 getenforcce
  406. 404 getenforce
  407. 405 setenforce permissive
  408. 406 getenforce
  409. 407 vim /etc/sysconfig/selinux
  410. 408 ./countdown 12
  411. 409 vim /etc/httpd/conf/httpd.conf
  412. 410 mkdir /web
  413. 411 echo hello > /web/index.html
  414. 412 systemctl restart httpd
  415. 413 systemctl status httpd
  416. 414 curl http://localhost
  417. 415 getenforce
  418. 416 setenforce enforcing
  419. 417 curl http://localhost
  420. 418 setenforce permissive
  421. 419 curl http://localhost
  422. 420 grep AVC /var/log/audit/audit.log
  423. 421 grep AVC /var/log/audit/audit.log | grep httpd
  424. 422 ls -lZ /web
  425. 423 ls -ldZ /web /var/www/html
  426. 424 man semanage-fcontext
  427. 425 # semanage fcontext -a -t httpd_sys_content_t "/web(/.*)?"
  428. 426 # restorecon -R -v /web
  429. 427 semanage fcontext -a -t httpd_sys_content_t "/web(/.*)?"
  430. 428 cd /etc/selinux/targeted/contexts/files/
  431. 429 ls
  432. 430 cat file_contexts.local
  433. 431 ls -Zd /web
  434. 432 restorecon -Rv /web
  435. 433 curl http://localhost
  436. 434 getenforce
  437. 435 setenforce
  438. 436 setenforce enforcing
  439. 437 curl http://localhost
  440. 438 getsebool -a
  441. 439 getsebool -a |wc
  442. 440 semanage fcontext -l |wc
  443. 441 getsebool -a |grep httpd | grep home
  444. 442 setsebool -P httpd_enable_homedirs on
  445. 443 getsebool -a |grep httpd | grep home
  446. 444 vim /etc/httpd/conf/httpd.conf
  447. 445 systemctl stop httpd
  448. 446 systemctl start httpd
  449. 447 systemctl status httpd
  450. 448 grep AVC /var/log/audit/audit.log
  451. 449 grep sealert /var/log/messages
  452. 450 sealert -l 503fe43c-3dc5-45cf-868b-ec8d0e8413ea | less
  453. 451 semanage port -a -t http_port_t -p tcp 82
  454. 452 systemctl start httpd
  455. 453 systemctl status httpd
  456. 454 grep sealert /var/log/messages
  457. 455 sealert -l cf4e5b63-0b2a-46cf-bce4-f06ef8e57c44 | less
  458. 456 man semanage-port
  459. 457 man semanage-fcontext
  460. 458 showmount -e 192.168.4.182
  461. 459 cd
  462. 460 yum install -y autofs
  463. 461 vim /etc/auto.master
  464. 462 vim /etc/auto.misc
  465. 463 vim /etc/auto.master
  466. 464 vim /etc/auto.files
  467. 465 systemctl enable --now autofs
  468. 466 cd /
  469. 467 ls
  470. 468 cd files
  471. 469 ls -al
  472. 470 cd anna
  473. 471 pwd
  474. 472 cd ..
  475. 473 cd linda
  476. 474 ls
  477. 475 mount
  478. 476 cd /
  479. 477 cd
  480. 478 ./countdown 12
  481. 479 vim /etc/exports
  482. 480 systemctl enable --now nfs-server
  483. 481 showmount -e localhost
  484. 482 cat /etc/exports
  485. 483 vim /etc/fstab
  486. 484 systemctl firewalld status
  487. 485 systemctl status firewalld
  488. 486 firewall-cmd --list-all
  489. 487 firewall-cmd --get-services
  490. 488 firewall-cmd --add-service http --permanent
  491. 489 firewall-cmd --list-all
  492. 490 firewall-cmd --reload
  493. 491 systemctl -t help
  494. 492 systemctl list-unit-files -t mounts
  495. 493 systemctl list-unit-files -t mount
  496. 494 systemctl list-unit-files -t service
  497. 495 systemctl list-unit-files -t target
  498. 496 systemctl get-default
  499. 497 systemctl set-default multi-user.target
  500. 498 systemctl isolate rescue.target
  501. 499 systemctl list-units
  502. 500 reboot
  503. 501 cat /etc/sysconfig/selinux
  504. 502 ls -Z /etc/shadow
  505. 503 cd /
  506. 504 ls
  507. 505 ls -a
  508. 506 rm /.autorelabel
  509. 507 rpm -qf /etc/selinux/targeted/policy/policy.31
  510. 508 reboot
  511. 509 rpm -qf /etc/selinux/targeted/policy/policy.31
  512. 510 yum remove selinux-policy-targeted.noarch
  513. 511 cd /etc/selinux/
  514. 512 cat semanage.conf
  515. 513 pwd
  516. 514 cd ..
  517. 515 rm -rf selinux/
  518. 516 reboot
  519. 517 yum install selinux-policy-targeted
  520. 518 reboot
  521. 519 ls -ldZ /web
  522. 520 systemctl status httpd
  523. 521 cd /etc/selinux/targeted/contexts/files/
  524. 522 cat file_contexts.local
  525. 523 systemctl set-default graphical.target
  526. 524 systemctl start graphical.target
  527. 525 history
  528. 526 reboot
  529. 527 getenforce
  530. 528 ls -Z /etc/shadow
  531. 529 cd /etc/selinux/
  532. 530 ls
  533. 531 rpm -qf /etc/selinux/targeted/
  534. 532 cd ..
  535. 533 cd
  536. 534 yum module install container-tools
  537. 535 exit
  538. 536 getenforce
  539. 537 vim /etc/sysconfig/selinux
  540. 538 reboot
  541. 539 history
  542.  
  543. ####### COMMANDS AS LINDA FOR SYSTEMD STARTED CONTAINER #########
  544. [linda@localhost ~]$ history
  545. 1 mkdir -p .config/systemd/user
  546. 2 cd .config/systemd/user/
  547. 3 podman run -d nginx
  548. 4 podman ps
  549. 5 pwd
  550. 6 podman generate systemd --name gifted_tu --files
  551. 7 vim container-gifted_tu.service
  552. 8 systemctl --user enable contianer-gifted_tu.service
  553. 9 vim container-gifted_tu.service
  554. 10 systemctl --user enable container-gifted_tu.service
  555. 11 exit
  556. 12 cd .config/systemd/user/
  557. 13 ls
  558. 14 systemctl --user enabel container-gifted_tu.service
  559. 15 systemctl --user enable container-gifted_tu.service
  560. 16 podman ps
  561. 17 su -
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement