Advertisement
thantzinz

rhcsa

Aug 12th, 2019
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.05 KB | None | 0 0
  1. man nm-settings
  2. man nmcli-examples
  3. nmcli con show "connexion_name" | grep ipv4.dad-timeout
  4. nmcli con add type ethernet ifname ens32 ipv4.address 10.1.1.4/24 +ipv4.addresses 10.1.1.5/24 ipv4.gateway 10.1.1.1 ipv4.dns "1.1.1.1,2.2.2.2" ipv4.method {manual,dhcp} connection.autoconnect yes
  5. nmcli con add type ethernet ifname ens32 ip4 10.1.1.4/24 gw4 10.1.1.1
  6. nmcli connection add type ethernet ifname <interface-name> con-name <interface-name> ipv4.method manual ipv4.address <IP>/<prefix> ipv4.gateway <GW-address>
  7. export SYSTEMD_EDITOR=/usr/bin/vi; sytemctl edit --full NetworkManager-wait-online.service
  8. ###########
  9. systemd.debug-shell enforcing=0 rd.break [in tty9, don't need password]
  10. systemd.unit=emergency.target,
  11. restorecon /etc/shadow
  12. setenforce 1
  13.  
  14. systemd.unit=rescue.target [ use of rd.break to interrupt the boot process before control is passed from initramfs to systemd]
  15. systemctl status $$
  16. ###########
  17. eval $(which tcpdump)
  18. ##########
  19. systemctl edit --full rhel-autorelabel.service << changes .autorelabel file to other name causes reboot loop
  20. ###########
  21. yum install setools-console policycoreutils-python
  22. seinfo -t
  23. seinfo -r
  24. semanage user -l
  25. semanage fcontext -l
  26. fixfiles -F restore (this is what is done when touching /.autorelabel and rebooting)
  27. grubby --info /boot/vmlinuz-3.10.0-229.4.2.el7.x86_64
  28. grubby --info=ALL
  29. #############
  30. echo "Hardening files..."
  31. find / -type f -perm /00700 -a -uid 0 -exec chmod u-wrx {} \; 2>/dev/null
  32. find / -type f -perm /00070 -a -gid 0 -exec chmod g-wrx {} \; 2>/dev/null
  33. echo "Hardening directories..."
  34. find / -type d -perm /00200 -a -uid 0 -exec chmod u-w {} \; 2>/dev/null
  35. find / -type d -perm /00020 -a -gid 0 -exec chmod g-w {} \; 2>/dev/null
  36. echo "Correcting a couple things..."
  37. find /sbin -type f -perm /00000 -a -uid 0 -exec chmod u+x {} \; 2>/dev/null
  38. find /usr/sbin -type f -perm /00000 -a -uid 0 -exec chmod u+x {} \; 2>/dev/null
  39. ###########
  40. getcap `which ping`
  41. find /usr/bin /usr/lib -perm /4000 -user root [find SUID]
  42. find /usr/bin /usr/lib -perm /2000 -user root [find SGID]
  43. setcap cap_net_bind_service=ep `which ncat` to be able to bind ports < 1024
  44. ###########
  45. echo -e '.com\nAcom' | grep -F .co
  46. echo -e 'a\n a\n a' | grep -E '^\s{1,11}a'
  47.  
  48. expandtab tabstop=1 shiftwidth=1
  49. set et list tabstop=4
  50. set et ts=2 sw=2 nu ic
  51. imap jj <Esc>
  52. :se all
  53. :se
  54. ####################
  55. pssh -i -H "172.20.0.33 172.20.0.35" "tmsh save sys ucs \$HOSTNAME.20190819.ucs"
  56. f5s="172.20.0.33 172.20.0.34 172.20.0.35"
  57. for i in $f5s ; do ssh $i "echo \$HOSTNAME ; uptime" ; done
  58. #############
  59. echo 'export TESTPROFILE=1' >> /etc/profile
  60. echo 'export TESTBASHRC=1' >> /etc/bashrc
  61. env | grep TEST
  62. ssh 127.0.0.1 "env | grep TEST"
  63. ###
  64. X="Hi There"
  65. bash
  66. echo $X
  67. export X="Hi There"
  68. bash
  69. echo $X
  70. #############
  71. Local Var vs Global Var
  72. FOO=BAR
  73. env | grep FOO
  74. set | grep FOO
  75. FOO=BAR
  76. unset FOO
  77. export FOO=BAR
  78. env | grep FOO
  79. set | grep FOO
  80. printenv | grep FOO
  81. printenv: Lists out all global ENVs set.
  82. set: Lists out all the ENVs (global as well local)
  83. ###############
  84. time
  85. \time
  86. ###############
  87. for ((i=1;i<10;i++));do echo $i;done
  88. ###############
  89. echo 'dtdi ' >> bigip\ 4.conf
  90. ls bigip*conf | xargs grep dtdi ; ls bigip*conf | xargs -t -0 grep dtdi
  91. find ./ -iname bigip\*.conf -print0 | xargs -t -0 grep dtdi
  92. find /tmp -name core -type f -print0 | xargs -t -0 /bin/rm -f
  93. (find ./ -iname bigip\*.conf -print0 | xargs -n1 -0 -t grep dtdi)
  94. VS
  95. (find ./ -iname bigip\*.conf -print0 | xargs -0 -t grep dtdi)
  96. ###############
  97. for i in *; do egrep '^[a-zA-Z]+$' <<<"$i"; done
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104. sudo subscription-manager remove --all
  105. sudo subscription-manager unregister
  106. sudo subscription-manager clean
  107. sudo subscription-manager register
  108. sudo subscription-manager refresh
  109. sudo subscription-manager attach --auto
  110. Execute sudo subscription-manager repos --list-enabled to see all actually enabled subscriptions.
  111. Execute sudo subscription-manager repos --list to see all subscriptions that are available for you.
  112. Execute sudo subscription-manager repos --enable <repo> if you want to add additional repos.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement