How to use Vite with VPN enabled, quick solution
29
2 min.

29
3 min.
We will need nginx and docker to work. If they are not already installed, run the following commands:
sudo apt update && sudo apt install nginx docker.io -y
Or check if they are installed:
docker --version && nginx -v
Never work as the root user. Let's create a new user and give them administrator rights.
Adding a user:
adduser user # Replace ‘user’ with your name
The output will look like this:
Adding user ‘user’ ...Enter new UNIX password:(enter your password; characters will not be displayed).
Granting privileges and checking:
usermod -aG sudo user groups user
Expected output:
user : user sudo.
This is the most reliable way to protect against brute force attacks.
If you already have an SSH key on your computer, simply send it to the server:
ssh-copy-id user@server_ip
If you don't have a key, create one:
ssh-keygen -t ed25519 -C “user@vps” # Then send it using the ssh-copy-id command above
Disabling password login and root access
Now, let's disable any other login methods except for your key.
Open the config file: sudo nano /etc/ssh/sshd_config
Find and change (or add) the following lines:
PermitRootLogin no - prohibits direct login to the system as root via SSH;PasswordAuthentication no - Disables the ability to log in to the server using a regular password;ChallengeResponseAuthentication no - Disables challenge-response authentication;UsePAM no - Disables the use of the PAM (Pluggable Authentication Modules) module for SSH.Restart the service: sudo systemctl restart ssh
Now, when you try to log in as root, you will see:
root@ip: Permission denied (publickey).
The firewall blocks all ports except those that we allow.
For greater security, change the port for SSH to another one, and also add it to the UFW config!
sudo ufw enable sudo ufw allow 22/tcp sudo ufw allow 80/tcp sudo ufw allow 443/tcp sudo ufw status
The output of the
statuscommand should be as follows:Status: active To Action From -- ------ ---- 22/tcp ALLOW Anywhere
React2Shell is a critical vulnerability that allows hackers to execute their code on your server via React forms. 69% of all cloud instances on Next.js are at risk.
Check the list of processes and files. Suspicious signs:
ssh.sh, sex.sh, kai.tar.gz, httd.top or htop command.Update Next.js: Urgently update to secure versions: 15.0.5, 15.1.9, 15.2.6, 15.3.6, 15.4.8, 15.5.7, 16.0.7.
Node.js 24: Use the new Node permissions model to restrict file access.
Secure Docker:
--read-only flag.If you have been hacked: Remove infected subdirectories/containers, clear caches, and be sure to change all secret keys and passwords.
Similar categories: