Sunday 15 September 2013

Ubuntu - Secure

Hi,

There are some things you need you take care for your secure:
  1. fail2ban
    • http://www.servermom.com/how-to-install-fail2ban-to-protect-server-from-brute-force-ssh-login-attempts-ubuntu/370/
  2. Generate SSH Public Key
    1. Your computer
      • cd .ssh
      • ssh-keygen -t dsa
        • Enter file in which to save the key (/home/shin/.ssh/id_dsa): your-name
        • Enter passphrase (empty for no passphrase): your-hard-password
        • Enter same passphrase again: re-type-your-hard-password
      • We have your-name.pub file in .ssh folder, and copy it to your-server
        • scp your-name.pub your-server-username@your-server:./your-name.pub
        • scp your-name.pub your-server-username@your-server:./your-name.pub
        • --OR--
        • scp -P[port] your-name.pub your-server-username@your-server:./your-name.pub
          • E.G.:
            • my.pub my@server:./my.pub
            • my.pub my@server:./my.pub
            • my.pub -P22 my@server:./my.pub
              • Type your password on your server
    2. Your server
      1. touch .ssh/authorized_keys
      2. sudo chmod 600 .ssh/authorized_keys
      3. cat your-name.pub >> .ssh/authorized_keys
      4. rm your-name.pub
  3. Try to access your-server using SSH Public Keys
    • ssh your-server-username@your-server
      • Type your-password when create your-name.pub file
  4. Limit users can not access your-server using ssh
    • sudo vim /etc/ssh/sshd_config
      • AllowUsers <user1> <user2>

Good luck!

No comments:

Post a Comment