ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Aaron's CentOS7 Scripts

    IT Discussion
    5
    24
    3.3k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • scottalanmillerS
      scottalanmiller
      last edited by

      Let me see about cleaning it up.

      A 1 Reply Last reply Reply Quote 0
      • A
        Alex Sage @scottalanmiller
        last edited by

        @scottalanmiller said:

        Let me see about cleaning it up.

        THANKS! 😄

        1 Reply Last reply Reply Quote 0
        • mlnewsM
          mlnews
          last edited by

          Okay, here is the CentOS 7 specific one (should work on CentOS 6, Fedora 23, but it is for C7) with all but two users stripped out to demonstrate the wheel and non-wheel user functions. And before anyone notices, yes I need to update the key length.

          #!/bin/bash
          useradd scott -u 1101 -c "Scott Alan Miller" -G wheel
          useradd danielle -u 1107 -c "Danielle Ralston"
          
          for i in $(ls /home); do mkdir -p /home/$i/.ssh; done
          
          echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDPdBvgVUD/gHJl/inuOMGDgUXT88pdPrEM1WFdYqlnG4QximJ0HEqSweSlK8Qhxg6u7B+gPtR2GDxyLOydajARXNoR6d5W/Aupvet8vUVAXp5sIfjyYGcrZOM4dboWE0MkKuVtJX+ZEEXuLojqd9RvICnsBYhV3KwzuGimtf1c3z8hau82bKc7fxvsF1KBV6luLyb6MFlEgapf32v0j8aSoMmGHxcNBoR/H+iJxEUMLr0d4ecZNSW9864J+dy6qT5Ei3bcPdwJZ7/gVcee7MVDYzPtbAXEtgT/U4r4zghZvuLnB2N/sBpDm1MsZpzA4YdJw+Cm7V4RmAx+SmPoAzT scott@cc-lnx-jump' > /home/scott/.ssh/authorized_keys
          
          echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCcR7YY5dzaGtW4a3rte57aUE6Gqre7bco60vUM+UUoJyjlqH98P+GqkkMTUCiHELQR3HLMc5bpknaRcjqJtl1CpD5Wl3PgbFU0BD9mYbKcEGW1AET7hvYMPjJuC5lHYGDRgRLBTAuPFU2lijyMx2881BMmUNqWyNQTLzqKrWpleSq7hpMY3zdTSzt4I1T/S20zs2iWjxoGj0NboImwLwn2fJSuOVVVBCVWt7u8Hfau2yQ29b0sCFAge6rp2cJRn7dnN27K6J9jexQWZHBuxRdkdrdp+jOnObqwL47+2AmjeuGuzP2ZQyYvcgTynQKiyBWYhDl47kquYgHvwSyfFIYWAx2aJi7g7naJiX0AyQaKBcdC7p4/VKo/z54iStFV4/1Y3nY2+K4hX+NewrVopl4hmtwgA8YFXwGuEa7TEol6QOw288QSlUCUIQdSla6zewmAYm/e436SuQaW9mtRgNkhQzlhEagIfPVmwDbRyWt9zeueXGGuSPxaAtI28Ul0zCk8ukyZUyPBXAFMZyGQn0kot37Hcxxc8ewA/Vt5wms1TUowQmVc52X6ckMks+8XtcXB45E/BeISQFguNACYzjLwYPbQ8ir0+BA8+92+XUU8SkNLLtHSCCxTzuw/xlAh+1Dy7fPKt+YT3OAvwQRPIDNlqBaCN6+FNht4vsL05oGEaQ== danielle@cc-lnx-jump' > /home/danielle/.ssh/authorized_keys
          
          for i in $(ls /home); do chown -R $i:$i /home/"$i"; chmod 700 /home/"$i"; chmod 700 /home/"$i"/.ssh; chmod 600 /home/"$i"/.ssh/authorized_keys; restorecon /home/"$i"/.ssh; done
          
          if [ -f /etc/redhat-release ]; then
              sed -i 's/^%wheel/# %wheel/' /etc/sudoers
              sed -i 's/^#\s*\(%wheel\s\+ALL=(ALL)\s\+NOPASSWD:\s\+ALL\)/\1/' /etc/sudoers
              yum -y install epel-release
              yum -y install sysstat htop fail2ban yum-cron
          fi
          
          1 Reply Last reply Reply Quote 1
          • mlnewsM
            mlnews
            last edited by

            Heaven only knows why I posted from this account.

            1 Reply Last reply Reply Quote 1
            • A
              Alex Sage
              last edited by Alex Sage

              So you guys use first names only? What happens when you hire another Scott? No access to Linux servers for him? 😄

              scottalanmillerS 1 Reply Last reply Reply Quote 0
              • A
                Alex Sage
                last edited by

                I don't see where you define i?

                scottalanmillerS 2 Replies Last reply Reply Quote 0
                • scottalanmillerS
                  scottalanmiller @Alex Sage
                  last edited by

                  @anonymous said:

                  So you guys use first names only? What happens when you hire another Scott? No access to Linux servers for him? 😄

                  That's right. No email, either.

                  When you've been somewhere for seventeen years, you get to have a first name login.

                  1 Reply Last reply Reply Quote 2
                  • scottalanmillerS
                    scottalanmiller @Alex Sage
                    last edited by

                    @anonymous said:

                    I don't see where you define i?

                    I use it to refer to myself. It's self referential 😉

                    1 Reply Last reply Reply Quote 0
                    • scottalanmillerS
                      scottalanmiller @Alex Sage
                      last edited by

                      @anonymous said:

                      I don't see where you define i?

                      It's here...

                      for i in $(ls /home);
                      

                      "i" is defined in the statement, there is no need to defining it before then, BASH doesn't do that, like BASIC does, for example. You don't need to instantiate a variable before use. And it is set in the statement, so created and set all in one go.

                      1 Reply Last reply Reply Quote 0
                      • A
                        Alex Sage
                        last edited by

                        Going to release version 2.0 tonight I hope 🙂

                        1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 2 / 2
                        • First post
                          Last post