Advertisement
sandervanvugt

RHCSA day3 nov20

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