الإعداد الأولي على Linux VPS - إعداد الخادم
مقدمة
بعد نشر خادم Linux VPSie الخاص بك لأول مرة، نقترح بعض خطوات الإعداد لتعزيز
أمان خادم VPS الجديد الخاص بك.
الخطوة الأولى – تأكد من استلام معلومات تسجيل الدخول إلى VPS في صندوق الوارد
مع كل خادم VPSie جديد، نرسل إشعارًا بالبريد الإلكتروني يوضح اسم الخادم،
وعنوان IP وكلمة مرور root.
بناءً على المعلومات أعلاه، يتيح لك الإعداد الأولي تسجيل الدخول عن بُعد
كمستخدم root عبر ssh.
الخطوة الثانية – تسجيل الدخول إلى خادم VPS الجديد.
باستخدام عميل SSH مثل PuTTy أو SecureCRT، استخدم عنوان IP ومستخدم root وكلمة المرور الموجودة في
البريد الإلكتروني
الخطوة الثالثة – تغيير كلمة مرور root المولّدة من النظام وإضافة مستخدم جديد غير مخصص
root@myfirstvpsie:~# passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfullyلزيادة سهولة الاستخدام، يُوصى بإنشاء مستخدم غير مميّز لتشغيل
خادم VPS الخاص بنظام Linux. يساعد ذلك في الوقاية من الأوامر الخاطئة أو عمليات النسخ واللصق.
قبل المتابعة وإنشاء المستخدم مباشرة، يجب العلم بأن هناك بعض التفاصيل حول المستخدم الجديد
يمكن تحديدها عند الإنشاء:
root@myfirstvpsie:~# useradd
Usage: useradd [options] LOGIN
useradd -D
useradd -D [options]
Options:
-b, --base-dir BASE_DIR base directory for the home directory of the
new account
-c, --comment COMMENT GECOS field of the new account
-d, --home-dir HOME_DIR home directory of the new account
-D, --defaults print or change default useradd configuration
-e, --expiredate EXPIRE_DATE expiration date of the new account
-f, --inactive INACTIVE password inactivity period of the new account
-g, --gid GROUP name or ID of the primary group of the new
account
-G, --groups GROUPS list of supplementary groups of the new
account
-h, --help display this help message and exit
-k, --skel SKEL_DIR use this alternative skeleton directory
-K, --key KEY=VALUE override /etc/login.defs defaults
-l, --no-log-init do not add the user to the lastlog and
faillog databases
-m, --create-home create the user's home directory
-M, --no-create-home do not create the user's home directory
-N, --no-user-group do not create a group with the same name as
the user
-o, --non-unique allow to create users with duplicate
(non-unique) UID
-p, --password PASSWORD encrypted password of the new account
-r, --system create a system account
-R, --root CHROOT_DIR directory to chroot into
-s, --shell SHELL login shell of the new account
-u, --uid UID user ID of the new account
-U, --user-group create a group with the same name as the user
-Z, --selinux-user SEUSER use a specific SEUSER for the SELinux user mapping
إذا كان أي من خصائص المستخدم يجب ألا تكون افتراضية، فإليك بعض الخيارات أعلاه.
لنقم بإنشاء كلمة مرور لمستخدمنا "newuser".
root@myfirstvpsie:~# passwd newuser
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfullyلاختبار ذلك، اتصل ب localhost عبر ssh كمستخدم "newuser":
root@myfirstvpsie:~# ssh newuser@localhost
newuser@localhost's password:
$
Connection to localhost closed.حسنًا. لدينا مستخدم جديد ونتمكن من تسجيل دخول هذا المستخدم عبر ssh.
الخطوة الرابعة – تعزيز أمان خادم SSH في Linux قليلاً
يتضمن ذلك نقاطًا قليلة:
– رفض تسجيل دخول root
– رفض المصادقة بكلمة المرور والسماح فقط بمصادقة مفتاح RSA
– تغيير منفذ ssh من 22 إلى منفذ فوق النطاق المحجوز (1-1024).
غيّر التوجيه "PermitRootLogin" في sshd_config إلى "no".
تصف الروابط التالية النقطتين الأخريين: https://vpsie.com/activating-ssh-key-authentication-generating-key-pair/ https://vpsie.com/secure-linux-vps-ssh-hardening/
أعد الآن تشغيل شيطان ssh، ويجب أن تتغير الإعدادات.
وهذه هي الخطوات الأولية الأساسية لإعداد خادم VPS الجديد الخاص بك بنظام Linux. يمكنك البدء في نشر وتطبيقات الخادم وإعدادها من مستودع توزيعتك.
يمكنك في الواقع تجربة تلك الخطوات الأساسية للخوادم على منصتنا في دقائق معدودة باستخدام حل PCS (الحل الخاص بالسحابة) الذي يتيح لك امتلاك خوادم VPSie على شبكة خاصة – NAT – إعادة توجيه المنافذ – التحكم في حركة المرور الواردة والصادرة – عناوين IP متعددة للبوابة التي يمكنك استخدامها للتوازن بين الأحمال والتعافي من الأعطال.