---
title: "Windows Server OpenSSH Windows: Cách cài đặt và phân quyền bảo mật chuẩn"
description: "Hướng dẫn cài đặt OpenSSH Server trên Windows Server 2019/2022/2025, cấu hình đăng nhập bằng SSH Key và phân quyền tệp administrators_authorized_keys chuẩn bảo mật."
canonical: "https://thuecloud.vn/windows-server-openssh-windows-cach-cai-dat-va-phan-quyen-bao-mat-chuan"
markdown_url: "https://thuecloud.vn/windows-server-openssh-windows-cach-cai-dat-va-phan-quyen-bao-mat-chuan.md"
locale: "vi"
kind: "article"
published_at: "2026-11-22T16:18:20.560Z"
updated_at: "2026-11-22T16:18:18.845Z"
site: "ThueCloud.Vn"
estimated_tokens: 1799
---
# Windows Server OpenSSH Windows: Cách cài đặt và phân quyền bảo mật chuẩn

> Hướng dẫn cài đặt OpenSSH Server trên Windows Server 2019/2022/2025, cấu hình đăng nhập bằng SSH Key và phân quyền tệp administrators_authorized_keys chuẩn bảo mật.

- Canonical HTML: https://thuecloud.vn/windows-server-openssh-windows-cach-cai-dat-va-phan-quyen-bao-mat-chuan
- Markdown URL: https://thuecloud.vn/windows-server-openssh-windows-cach-cai-dat-va-phan-quyen-bao-mat-chuan.md
- Organization: ThueCloud.Vn
- Support Email: support@thuecloud.vn
- Hotline: 03333 499 48
- Published: 2026-11-22
- Updated: 2026-11-22

## Mục lục

- Cài đặt và kích hoạt OpenSSH Server trên Windows Server
- Cấu hình SSH Key và phân quyền administrators_authorized_keys
- Câu hỏi thường gặp (FAQ)
  - Tại sao tôi đã bỏ public key vào C:\Users\Administrator\.ssh\authorized_keys nhưng SSH vẫn đòi mật khẩu?
  - Có nên đổi cổng mặc định 22 trên Windows OpenSSH không?
  - Dùng OpenSSH trên Windows có hỗ trợ truyền file qua scp và sftp từ máy Linux/Mac không?

Thay vì phải mở giao diện Remote Desktop (RDP) nặng nề mỗi lần cần chạy script PowerShell hoặc đồng bộ file lên [Windows Cloud VPS](https://thuecloud.vn/vps-viet-nam), việc cài đặt **OpenSSH Server** tích hợp sẵn trong Windows Server giúp bạn quản trị nhanh gọn từ terminal, tự động hóa deploy CI/CD và sử dụng SFTP an toàn. Tuy nhiên, phân quyền file `authorized_keys` trên Windows có một quy tắc rất khác so với Linux mà nhiều quản trị viên hay mắc lỗi.

> **Tóm tắt nhanh (TL;DR):**
> - **Cài đặt 1 lệnh:** Dùng `Add-WindowsCapability` trong PowerShell quyền Administrator.
> - **Bẫy phân quyền Administrator:** Tài khoản thuộc nhóm `Administrators` không đọc `~/.ssh/authorized_keys` mà đọc file `C:\ProgramData\ssh\administrators_authorized_keys`.
> - **Tắt đăng nhập mật khẩu:** Sau khi test SSH Key thành công, đặt `PasswordAuthentication no` trong `sshd_config`.
> - *Cập nhật: 11/2026*

## Cài đặt và kích hoạt OpenSSH Server trên Windows Server

Mở PowerShell với quyền Administrator và chạy các lệnh sau:

```powershell
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
Start-Service sshd
Set-Service -Name sshd -StartupType 'Automatic'
New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
```

Đặt PowerShell làm shell mặc định thay cho CMD khi đăng nhập SSH:

```powershell
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force
```

## Cấu hình SSH Key và phân quyền `administrators_authorized_keys`

Nếu bạn đăng nhập bằng tài khoản `Administrator` (hoặc bất kỳ user nào nằm trong nhóm Administrators), OpenSSH trên Windows sẽ tìm khóa công khai tại `C:\ProgramData\ssh\administrators_authorized_keys`.

Sau khi dán khóa công khai vào tệp này, bạn **bắt buộc** phải xóa quyền kế thừa và chỉ cấp quyền cho `SYSTEM` và `Administrators` bằng `icacls`:

```powershell
icacls.exe "C:\ProgramData\ssh\administrators_authorized_keys" /inheritance:r /grant "Administrators:F" /grant "SYSTEM:F"
```

Cuối cùng, mở `C:\ProgramData\ssh\sshd_config`, đặt `PubkeyAuthentication yes`, `PasswordAuthentication no` rồi chạy `Restart-Service sshd`. Nếu bạn cần kết hợp Windows VPS với hệ thống automation hoặc web proxy, hãy xem thêm [triển khai AI Automation bằng n8n + Claude](https://thuecloud.vn/trien-khai-ai-automation-nganh-ban-le-tmdt-bang-n8n-claude-tren-cloud-vps) và [triển khai Next.js + Nginx + PM2](https://thuecloud.vn/trien-khai-next-js-nginx-proxy-pm2-cau-hinh-bien-moi-truong-secrets-va-ssl-let-s-encrypt).

| Tài khoản đăng nhập | Đường dẫn file chứa Public Key | Lưu ý phân quyền NTFS |
| :--- | :--- | :--- |
| **User thường (Standard)** | `C:\Users\<user>\.ssh\authorized_keys` | Chỉ `SYSTEM`, `Administrators` và `<user>` có quyền |
| **Nhóm `Administrators`** | `C:\ProgramData\ssh\administrators_authorized_keys` | Bắt buộc `/inheritance:r`, chỉ cấp `Administrators` & `SYSTEM` |

> **Vận hành Windows Server linh hoạt trên ThueCloud.Vn**
> Hạ tầng **KVM Enterprise NVMe** tại `vn-hn` hỗ trợ Windows Server bản quyền dùng thử/sạch, **SLA 99,9%**, **VAT 0%** và **hoàn tiền 07 ngày**. Bắt đầu từ **VPS VN 3 (139.000đ/tháng** năm hoặc **170.000đ/tháng)** để có tài nguyên thoải mái cho Windows Server và OpenSSH. Xem chi tiết [bảng giá](https://thuecloud.vn/pricing) và [FAQ](https://thuecloud.vn/faq).

## Câu hỏi thường gặp (FAQ)

### Tại sao tôi đã bỏ public key vào `C:\Users\Administrator\.ssh\authorized_keys` nhưng SSH vẫn đòi mật khẩu?
Vì mặc định trong `C:\ProgramData\ssh\sshd_config` của Windows có đoạn `Match Group administrators` ép dùng tệp `C:\ProgramData\ssh\administrators_authorized_keys`. Bạn phải đặt key vào tệp này và chạy `icacls`.

### Có nên đổi cổng mặc định 22 trên Windows OpenSSH không?
Nên đổi sang cổng khác hoặc dùng Windows Defender Firewall giới hạn chỉ IP văn phòng/VPN được phép kết nối vào cổng 22 để tránh bot dò quét.

### Dùng OpenSSH trên Windows có hỗ trợ truyền file qua `scp` và `sftp` từ máy Linux/Mac không?
Có. OpenSSH Server trên Windows tích hợp sẵn `sftp-server.exe` và hỗ trợ `scp` đầy đủ tương thích với mọi client Linux, macOS và WinSCP.

## References / Sources

- https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse
- https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_keymanagement

---

## Navigation & Machine-Readable Endpoints

- [Site Summary (llms.txt)](https://thuecloud.vn/llms.txt)
- [Full Technical Reference (llms-full.txt)](https://thuecloud.vn/llms-full.txt)
- [Pricing Catalog (Markdown)](https://thuecloud.vn/pricing.md)
- [Blog & Technical Guides (Markdown)](https://thuecloud.vn/blog.md)
- [XML Sitemap](https://thuecloud.vn/sitemap.xml)
