arrow_upward

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tutorial] How to (properly) secure your VPS
#1
I. Don't use the root account! Create a new sudoer account
Spoiler Expand
(Make sure you install sudo from your package manager if it's not installed)

1. Create the account. Enter all the details that is prompted.
useradd <username>

2. Add the user to the sudoer group
echo '<username> ALL=(ALL) ALL' >> /etc/sudoers

3. Disable root login!
echo 'PermitRootLogin no' >> /etc/ssh/sshd_config

4. Restart sshd
systemctl restart sshd

II. Use SSH Keys!

Linux/Mac client
Spoiler Expand
1. Generate the key.
If prompted for the path, just press enter.
As for the password, it's your choice to use it or not. (Though it's recommended to use a password for the key file)
ssh-keygen -t rsa
2. Copy over the public key to your server
ssh-copy-id <username>@<host>

You can now connect to the server using ssh keys.
Windows
Spoiler Expand
In Progress...

III. Disable password authentication!
Spoiler Expand
1. Just run this command to disable
echo 'PasswordAuthentication no' >> /etc/ssh/sshd_config
2. Restart sshd
systemctl restart sshd

IV. Install fail2ban
CentOS
Spoiler Expand
1. Install
yum install epel-release #Needed repo
yum install fail2ban
2. Run and enable run at startup
systemctl enable fail2ban
systemctl start fail2ban
Debian
Spoiler Expand

apt-get install fail2ban
2. Run and enable run at startup
systemctl enable fail2ban
systemctl start fail2ban
http://FreeVPS.club - Free VPSs!


Messages In This Thread

Possibly Related Threads…
Thread
Author
Replies
Views
Last Post

person_pin_circle Users browsing this thread: 1 Guest(s)
Sponsors: VirMach - Host4Fun - CubeData - Evolution-Host - HostDare - Hyper Expert - Shadow Hosting - Bladenode - Hostlease - RackNerd - ReadyDedis - Limitless Hosting