Advertisement
sandervanvugt

RHCSA july23 day3

Jul 20th, 2023
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.37 KB | None | 0 0
  1. root@rhcsa ~]# history
  2. 1 ls
  3. 2 exit
  4. 3 tar cvzf archive.tgz /etc
  5. 4 tar tvf archive.tgz
  6. 5 history
  7. 6 grep -v '^$' /etc/dnsmasq.conf
  8. 7 grep -v '^$' /etc/dnsmasq.conf | sort
  9. 8 grep -v '^$' /etc/dnsmasq.conf | sort > /var/tmp/dnslines.txt
  10. 9 useradd bob
  11. 10 find / -user bob
  12. 11 find / -user bob -type f
  13. 12 mkdir /root/userfiles; find / -user bob -type f -exec cp {} /root/userfiles/ \;
  14. 13 ls -al /root/userfiles/
  15. 14 history
  16. 15 ls -ld /etc/sudo*
  17. 16 visudo
  18. 17 vim /etc/sudoers.d/bob
  19. 18 tail -1 /etc/passwd
  20. 19 su - bob
  21. 20 passwd bob
  22. 21 su - bob
  23. 22 cat /etc/sudoers.d/bob
  24. 23 id student
  25. 24 history
  26. 25 visudo
  27. 26 exit
  28. 27 history
  29. 28 su - lisa
  30. 29 grep lisa /etc/sudoers
  31. 30 cat /etc/passwd
  32. 31 head /etc/passwd
  33. 32 useradd --help | less
  34. 33 useradd bill -p password
  35. 34 tail -1 /etc/shadow
  36. 35 tail -5 /etc/shadow
  37. 36 echo password | passwd --stdin bill
  38. 37 tail -5 /etc/shadow
  39. 38 vim /etc/login.defs
  40. 39 useradd -p password peter
  41. 40 su - student
  42. 41 cd /etc/skel/
  43. 42 ls -a
  44. 43 touch hellefile
  45. 44 useradd bea
  46. 45 ls -l /home/bea
  47. 46 ls -al /home/bea
  48. 47 id lisa
  49. 48 id student
  50. 49 groupadd sales
  51. 50 usermod -aG sales lisa
  52. 51 usermod --help
  53. 52 usermod -G wheel lisa
  54. 53 id lisa
  55. 54 usermod -aG sales lisa
  56. 55 id lisa
  57. 56 exit
  58. 57 chage --help
  59. 58 chage -l lisa
  60. 59 chage -M 99 lisa
  61. 60 chage -l lisa
  62. 61 chage lisa
  63. 62 /home/student/countdown 15
  64. 63 vim /etc/login.defs
  65. 64 cd /etc/skel/
  66. 65 touch newfile
  67. 66 vim /etc/default/useradd
  68. 67 for i in anna anouk lisa linda; do useradd $i; done
  69. 68 for i in anna anouk lisa linda; do echo password | passwd --stdin $i; done
  70. 69 groupadd profs
  71. 70 groupadd students
  72. 71 usermod -aG profs anouk
  73. 72 usermod -aG profs anna
  74. 73 usermod -aG students linda
  75. 74 usermod -aG students lisa
  76. 75 ls -l /etc/hosts
  77. 76 cd /tmp
  78. 77 echo hello > hellofile
  79. 78 chown linda hellofile
  80. 79 chmod 077 hellofile
  81. 80 ls -l hellofile
  82. 81 su - linda
  83. 82 cd
  84. 83 cd /home/linda
  85. 84 touch lindafile
  86. 85 ls -l lindafile
  87. 86 echo linda > lindafile
  88. 87 su - linda
  89. 88 ls -l
  90. 89 chmod 640 lindafile
  91. 90 su - linda
  92. 91 cd
  93. 92 cd /tmp
  94. 93 mkdir testdir
  95. 94 touch testdir/file{1..10}
  96. 95 ls -l testdir/
  97. 96 chmod --helo
  98. 97 chmod --hel
  99. 98 chmod -R +x testdir/
  100. 99 ls -l testdir/
  101. 100 chmod -R -x testdir/
  102. 101 mkdir testdir/subdir
  103. 102 chmod -R +X testdir/
  104. 103 ls -ld testdir/
  105. 104 ls -l testdir/
  106. 105 cd
  107. 106 mkdir -p /data/profs /data/students
  108. 107 ls -l /data
  109. 108 chown :profs /data/profs
  110. 109 ls -l /data
  111. 110 chgrp students /data/students
  112. 111 ls -l /data
  113. 112 chmod 770 /data/students
  114. 113 ls -l /data
  115. 114 chmod g+w,o-rx /data/profs
  116. 115 ls -l /data
  117. 116 su - anna
  118. 117 chmod g+s /data/profs
  119. 118 ls -l /data
  120. 119 su - anna
  121. 120 su - anouk
  122. 121 chmod +t /data/profs
  123. 122 ls -l /data
  124. 123 su - anouk
  125. 124 umask
  126. 125 /home/student/countdown 15
  127. 126 mkdir -p /data/students /data/profs
  128. 127 ls /data
  129. 128 cd /data
  130. 129 chmod 770 *
  131. 130 ls -l
  132. 131 umask
  133. 132 cd profs
  134. 133 umask 002
  135. 134 touch rootfile
  136. 135 ls -l rootfile
  137. 136 lsblk
  138. 137 poweroff
  139. 138 vim /etc/fstab
  140. 139 fdisk -l
  141. 140 touch ff
  142. 141 mount -o remount,rw /
  143. 142 touch ff
  144. 143 vim /etc/fstab
  145. 144 blkid
  146. 145 blkid | grep sda5 | awk '{ print $2 '}
  147. 146 blkid | awk '/sda5/ { print $2 '}
  148. 147 blkid | awk '/sda5/ { print $2 '} >> /etc/fstab
  149. 148 vim /etc/fstab
  150. 149 reboot
  151. 150 blkid
  152. 151 history
  153. 152 xxd -l 512 /dev/sda
  154. 153 cat /etc/fstab
  155. 154 blkid
  156. 155 df -h
  157. 156 xfs_admin -L kona /dev/sda5
  158. 157 umount /dev/sda5
  159. 158 xfs_admin -L kona /dev/sda5
  160. 159 vim /etc/fstab
  161. 160 ln /home/student/countdown /usr/local/bin/countdown
  162. 161 ln /home/student/countdown /usr/local/sbin/countdown
  163. 162 history
  164. 163 free -m
  165. 164 fdisk /dev/sda
  166. 165 lsblk
  167. 166 mkswap /dev/sda6
  168. 167 vim /etc/fstab
  169. 168 swapon -a
  170. 169 free -m
  171. 170 dd if=/dev/zero of=/swapfile bs=1M count=1024
  172. 171 mkswap /swapfile
  173. 172 chmod 600 /swapfile
  174. 173 swapon /swapfile
  175. 174 free -m
  176. 175 history
  177. 176 df -h
  178. 177 dd if=/dev/sr0 of=/rhel9.iso bs=1M
  179. 178 mkdir /repo
  180. 179 vim /etc/fstab
  181. 180 mount -a
  182. 181 mount
  183. 182 ls /repo
  184. 183 ls /repo/BaseOS
  185. 184 history
  186. 185 tail -1 /etc/fstab
  187. 186 df -h
  188. 187 countdown 1
  189. 188 dd if=/dev/sr0 of=/dummy
  190. 189 history
  191. 190 ls /repo
  192. 191 dnf config-manager --add-repo="file:///repo/BaseOS"
  193. 192 dnf config-manager --add-repo="file:///repo/AppStream"
  194. 193 cd /etc/yum.repos.d/
  195. 194 ls
  196. 195 vim repo_BaseOS.repo
  197. 196 cd
  198. 197 dnf repolist
  199. 198 dnf search nmap
  200. 199 dnf install nmap
  201. 200 vim /etc/yum.repos.d/repo_BaseOS.repo
  202. 201 vim /etc/yum.repos.d/repo_AppStream.repo
  203. 202 dnf install nmap
  204. 203 history
  205. 204 cat /etc/yum.repos.d/repo_BaseOS.repo
  206. 205 ls /repo
  207. 206 cd /etc/yum.repos.d/
  208. 207 vim repo_BaseOS.repo
  209. 208 dnf list 'selinux*'
  210. 209 dnf provides */seinfo
  211. 210 seinfo
  212. 211 dnf provides */Containerfile
  213. 212 dnf group list
  214. 213 dnf module list
  215. 214 dnf module info nginx
  216. 215 cd
  217. 216 top
  218. 217 dd if=/dev/zero of=/dev/null &
  219. 218 top
  220. 219 echo 0 > /sys/bus/cpu/devices/cpu1/online
  221. 220 top
  222. 221 echo 1 > /sys/bus/cpu/devices/cpu1/online
  223. 222 top
  224. 223 killall dd
  225. 224 cat /proc/sys/vm/swappiness
  226. 225 echo 40 > /proc/sys/vm/swappiness
  227. 226 cat /proc/sys/vm/swappiness
  228. 227 sysctl -a | grep swapp
  229. 228 vim /etc/sysctl.d/swappi.conf
  230. 229 tuned-adm list
  231. 230 ls /usr/lib/tuned/
  232. 231 ls /usr/lib/tuned/virtual-guest/tuned.conf
  233. 232 cat /usr/lib/tuned/virtual-guest/tuned.conf
  234. 233 tuned-adm profile powersav e
  235. 234 tuned-adm profile powersave
  236. 235 tuned-adm list
  237. 236 countdown 13
  238. 237 systemctl status NetworkManager
  239. 238 ip addr show
  240. 239 nmtui
  241. 240 ip a
  242. 241 nmtui
  243. 242 exit
  244. 243 hostnamectl status
  245. 244 reboot
  246. 245 exit
  247. 246 timedatectl status
  248. 247 timedatectl set-time 17:48
  249. 248 date -s 17:48
  250. 249 systemctl status chronyd
  251. 250 vim /etc/chrony.conf
  252. 251 systemctl restart chronyd
  253. 252 chronyc sources
  254. 253 history
  255. 254 systemctl -t help
  256. 255 systemctl list-units -t service
  257. 256 systemctl cat rsyslog.service
  258. 257 systemctl status sshd.service
  259. 258 systemctl status sshd
  260. 259 systemctl disable --now sshd
  261. 260 systemctl status sshd
  262. 261 systemctl enable --now sshd
  263. 262 systemctl status sshd
  264. 263 kill -9 6928
  265. 264 systemctl status sshd
  266. 265 systemctl cat sshd
  267. 266 systemctl status sshd
  268. 267 history
  269. 268 dnf install vsftpd
  270. 269 systemctl cat vsftpd
  271. 270 systemctl cat sshd
  272. 271 systemctl cat vsftpd
  273. 272 systemctl edit vsftpd.service
  274. 273 systemctl cat vsftpd
  275. 274 systemctl edit vsftpd.service
  276. 275 systemctl cat vsftpd
  277. 276 systemctl status vsftpd
  278. 277 systemctl enable --now vsftpd
  279. 278 systemctl status vsftpd
  280. 279 kill -9 7244
  281. 280 kill -9 7245
  282. 281 systemctl status vsftpd
  283. 282 systemctl cat vsftpd
  284. 283 history
  285. 284 systemctl show vsftpd
  286. 285 man -k systemd
  287. 286 man -k systemd | wc -l
  288. 287 man systemd.directives
  289. 288 man systemd.resource-control
  290. 289 systemctl disable --now vsftpd
  291. 290 systemctl mask vsftpd
  292. 291 systemctl start vsftpd
  293. 292 journalctl
  294. 293 journalctl -p err
  295. 294 journalctl -u sshd
  296. 295 journalctl -xb
  297. 296 journalctl -f
  298. 297 dmesg
  299. 298 systemctl status sshd
  300. 299 systemctl status sshd -l
  301. 300 journalctl -u sshd
  302. 301 grep Storage /etc/systemd/journald.conf
  303. 302 mkdir /var/log/journal
  304. 303 ls -l /var/log/journal/
  305. 304 systemctl restart systemd-journal-flush.service
  306. 305 ls -l /var/log/journal/
  307. 306 history
  308. 307 lsblk
  309. 308 gdisk /dev/sdb
  310. 309 lsblk
  311. 310 pvcreate /dev/sdb1
  312. 311 pvs
  313. 312 vgcreate vgdata /dev/sdb1
  314. 313 vgs
  315. 314 lvcreate -n lvdata -L 1G vgdata
  316. 315 lvcreate -n lvdata -l 100%FREE vgdata
  317. 316 mkfs.ext4 /dev/vgdata/lvdata
  318. 317 vim /etc/fstab
  319. 318 mkdir /lvdata
  320. 319 mount -a
  321. 320 history
  322. 321 tail -1 /etc/fstab
  323. 322 mount
  324. 323 tail -1 /etc/fstab
  325. 324 ls -l /dev/mapper/vgdata-lvdata /dev/vgdata/lvadata
  326. 325 ls -l /dev/mapper/vgdata-lvdata /dev/vgdata/lvdata
  327. 326 gdisk -l /dev/sdb
  328. 327 fdisk /dev/sda
  329. 328 lsblk
  330. 329 vgcreate vgfiles /dev/sda9
  331. 330 lvcreate -l 255 -n lvfiles /dev/vgfiles
  332. 331 mkfs.ext4 /dev/vgfiles/lvfiles
  333. 332 mount /dev/vgfiles/lvfiles /mnt
  334. 333 df -h
  335. 334 vgs
  336. 335 vgextend vgfiles /dev/sdb2
  337. 336 vgs
  338. 337 df -h
  339. 338 lvs
  340. 339 lvextend -l +50%FREE /dev/vgfiles/lvfiles
  341. 340 lvs
  342. 341 df -h
  343. 342 resize2fs /dev/vgfiles/lvfiles
  344. 343 df -h
  345. 344 lvextend -r -v -l +50%FREE /dev/vgfiles/lvfiles
  346. 345 df -h
  347. 346 lvextend -r -L -1G /dev/vgfiles/lvfiles
  348. 347 lvreduce -r -L -1G /dev/vgfiles/lvfiles
  349. 348 history
  350. 349 lvextend --size 500M -r /dev/vgfiles/lvfiles
  351. 350 lvextend --size +500M -r /dev/vgfiles/lvfiles
  352. 351 vim /boot/grub2/grub.cfg
  353. 352 vim /etc/default/grub
  354. 353 grub2-mkconfig -o /boot/grub2/grub.cfg
  355. 354 reboot
  356. 355 systemctl get-default
  357. 356 systemctl set-default multi-user.target
  358. 357 systemctl get-default
  359. 358 systemctl set-default graphical.target
  360. 359 systemctl list-units -t target
  361. 360 systemctl cat bluetooth.target
  362. 361 systemctl cat graphical.target
  363. 362 history
  364. 363 getenforce
  365. 364 dnf install -y httpd
  366. 365 systemctl start httpd
  367. 366 ps Zaux | grep http
  368. 367 ls -Z /var/www
  369. 368 vim /etc/httpd/conf/httpd.conf
  370. 369 mkdir /web
  371. 370 vim /web/index.html
  372. 371 ls -ldZ /web
  373. 372 systemctl restart httpd
  374. 373 curl localhost
  375. 374 setenforce permissive
  376. 375 curl localhost
  377. 376 vim /etc/httpd/conf/httpd.conf
  378. 377 systemctl restart httpd
  379. 378 curl localhost
  380. 379 getenforce
  381. 380 setenforce enforcing
  382. 381 curl localhost
  383. 382 grep AVC /var/log/audit/audit.log
  384. 383 history
  385. 384 ps Zaux | less
  386. 385 ls -Zd /web
  387. 386 ls -Zd /var/www/html/
  388. 387 man semanage-fcontext
  389. 388 semanage fcontext -a -t httpd_sys_content_t "/web(/.*)?"
  390. 389 ls -Zd /web
  391. 390 restorecon -Rv /web
  392. 391 getenforce
  393. 392 curl localhost
  394. 393 history
  395. 394 man -k _selinux
  396. 395 dnf install -y selinux-policy-doc
  397. 396 man -k _selinux
  398. 397 man -k _selinux | grep http
  399. 398 man httpd_selinux
  400. 399 vim /etc/httpd/conf/httpd.conf
  401. 400 systemctl restart httpd
  402. 401 grep AVC /var/log/audit/audit.log
  403. 402 man httpd_selinux
  404. 403 man semanage-port
  405. 404 semanage port -a -t http_port_t -p tcp 82
  406. 405 systemctl restart httpd
  407. 406 getsebool -a | wc
  408. 407 getsebool -a | grep http
  409. 408 setsebool -P httpd_enable_homedirs on
  410. 409 semanage boolean -l -C
  411. 410 semanage fcontext -l -C
  412. 411 semanage port -l -C
  413. 412 dnf provides */sealert
  414. 413 journalctl | grep sealert
  415. 414 sealert -l b2868c7a-5f63-475e-ba90-cc2ca5ac502b | less
  416. 415 sealert -l ab0a8163-d944-4edc-bb26-a49240b62054 | less
  417. 416 history
  418. 417 mv /etc/hosts /var/www/html/
  419. 418 ls -Z /var/www/html/
  420. 419 restorecon -Rv /var/www/html
  421. 420 history
  422.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement