गाइड

नए VPS को 10 मिनट में सुरक्षित करें

शुरुआती10 मिनट पढ़ेंअपडेट किया गया 18 जून 2026
संक्षिप्त उत्तर

पाँच बदलाव नए सर्वर के विरुद्ध हर स्वचालित हमले को खत्म करते हैं: पासवर्ड बंद के साथ कुंजी-आधारित SSH, सीधे रूट लॉगिन नहीं, IPv4 और IPv6 दोनों को कवर करने वाला डिफ़ॉल्ट-अस्वीकार फ़ायरवॉल, अनअटेंडेड सुरक्षा अपडेट, और fail2ban। साथ में वे लगभग दस मिनट लेते हैं और किसी भी प्रदाता सुविधा से अधिक मायने रखते हैं।

01 SSH कुंजी बनाएं और इंस्टॉल करें

Do this from your own machine, not the server. Ed25519 keys are shorter and faster than RSA and are supported everywhere that matters.

ssh-keygen -t ed25519 -C "onionvps-$(date +%Y%m)"
ssh-copy-id -i ~/.ssh/id_ed25519.pub root@YOUR_SERVER_IP

02 गैर-रूट उपयोगकर्ता बनाएं

Working as root all the time removes a useful safety net and makes every mistake maximally expensive.

adduser --gecos "" ops
usermod -aG sudo ops
rsync --archive --chown=ops:ops ~/.ssh /home/ops

03 SSH डेमॉन को हार्डन करें

Disable password authentication entirely — brute force against key-only SSH is not possible. Keep a second terminal connected while you do this, so a mistake does not lock you out.

cat >/etc/ssh/sshd_config.d/99-hardening.conf <<'EOF'
PasswordAuthentication no
PermitRootLogin no
KbdInteractiveAuthentication no
AllowUsers ops
EOF
sshd -t && systemctl reload ssh

04 डिफ़ॉल्ट-अस्वीकार फ़ायरवॉल सेट करें

Cover IPv6 as well as IPv4. Every OnionVPS instance has a routed /64, so a v4-only ruleset leaves every service publicly reachable over v6.

ufw default deny incoming
ufw default allow outgoing
ufw allow 22/tcp
ufw allow 80,443/tcp
ufw enable
ufw status verbose   # confirm IPv6 shows as enabled

05 स्वचालित सुरक्षा अपडेट चालू करें

Unattended upgrades close the window between a patch being published and you noticing it exists.

apt install -y unattended-upgrades
dpkg-reconfigure -plow unattended-upgrades

06 fail2ban इंस्टॉल करें और स्नैपशॉट लें

fail2ban mostly reduces log noise once passwords are disabled, but it is cheap. Then snapshot the configured state — that becomes your known-good baseline.

apt install -y fail2ban && systemctl enable --now fail2ban

अक्सर पूछे जाने वाले प्रश्न

क्या मुझे SSH पोर्ट बदलना चाहिए?

यह सुरक्षा के बजाय शोर कम करना है, लेकिन प्रभावी शोर कम करना — अधिकांश स्कैनर केवल पोर्ट 22 आज़माते हैं। केवल-कुंजी प्रमाणीकरण के साथ, अवशिष्ट जोखिम किसी भी तरह नगण्य है।

अगर मैं खुद को लॉक कर दूं तो क्या?

नियंत्रण कक्ष में आउट-ऑफ़-बैंड VNC कंसोल का उपयोग करें। यह वर्चुअल सीरियल कंसोल से जुड़ता है और बिना नेटवर्क के काम करता है।