Community Tutorials macOS كيفية تكوين SSH على macOS
كيفية تكوين SSH على macOS
MACOS

كيفية تكوين SSH على macOS

SKYLINE Knowledge Base
Photo by Carl Heyerdahl on Unsplash

دليل عملي خطوة بخطوة لـ كيفية تكوين SSH على macOS. أوامر مختبرة في الإنتاج، متطلبات مسبقة، تحقق نهائي وروابط لمواضيع ذات صلة.

يحتوي macOS على خادم OpenSSH مدمج — معطّل افتراضيًا. تشغيله يتطلب تبديلًا واحدًا، لكن الإعداد المناسب للإنتاج يتضمن مفاتيح وإعدادًا محصّنًا.

المتطلبات المسبقة

  • macOS 12 Monterey أو أحدث، حساب admin.
  • مفتاح Ed25519 على محطة عملك.

الخطوة 1: تمكين Remote Login

sudo systemsetup -setremotelogin on
sudo systemsetup -getremotelogin

الخطوة 2: ادفع مفتاح SSH

ssh-copy-id you@mac.local
ssh -o PasswordAuthentication=no you@mac.local whoami

الخطوة 3: تحصين sshd_config

/etc/ssh/sshd_config.d/99-skyline.conf:

PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
MaxAuthTries 3
LoginGraceTime 30

أعد تحميل sshd:

sudo /usr/sbin/sshd -t
sudo systemsetup -setremotelogin off
sudo systemsetup -setremotelogin on

الخطوة 4: تقييد من يمكنه SSH

sudo dseditgroup -o create -q com.apple.access_ssh
sudo dseditgroup -o edit -a yourusername -t user com.apple.access_ssh

الخطوة 5: نقل SSH عن المنفذ 22

Port 2222

الخطوة 6: تكوين SSH للاستخدام اليومي

~/.ssh/config:

Host mac
    HostName mac.local
    User ops
    Port 2222
    IdentityFile ~/.ssh/id_ed25519

التحقق

sudo /usr/sbin/sshd -t
sudo log show --predicate 'process == "sshd"' --last 1h | tail -20

الخاتمة

OpenSSH على macOS هو نفس الخادم على Linux مع نظام إعادة تحميل مختلف (launchd).

الخطوات التالية

SKYLINE Engineering

@skyline

The engineering team at SKYLINE Industrial Solutions. We publish field-tested guides drawn from real KSA and GCC deployments.

See author profile
SKYLINE engineering services

Need this implemented for you?

Reading is free — building it right takes a team. SKYLINE engineers ship macOS for Aramco vendors, banks, hospitals and government agencies across Saudi Arabia. Talk to us before you start.

Aramco Approved Contractor ISO 9001 · ISO 27001 SAMA CSF aligned NCA ECC ready 247+ KSA clients

Comments

0 total · 0 threads
Be the first to leave a comment.