---
title: "Cài đặt và cấu hình OpenSSH Server Windows trên Windows Server 2022 VPS"
description: "Hướng dẫn cài đặt OpenSSH Server chính thức trên Windows Server 2022 VPS bằng PowerShell, cấu hình đăng nhập SSH Key (ed25519) và truyền file SCP/SFTP an toàn."
canonical: "https://thuecloud.vn/cai-dat-va-cau-hinh-openssh-server-windows-tren-windows-server-2022-vps"
markdown_url: "https://thuecloud.vn/cai-dat-va-cau-hinh-openssh-server-windows-tren-windows-server-2022-vps.md"
locale: "vi"
kind: "article"
published_at: "2026-11-22T16:18:11.614Z"
updated_at: "2026-11-22T16:18:10.011Z"
site: "ThueCloud.Vn"
estimated_tokens: 2159
---
# Cài đặt và cấu hình OpenSSH Server Windows trên Windows Server 2022 VPS

> Hướng dẫn cài đặt OpenSSH Server chính thức trên Windows Server 2022 VPS bằng PowerShell, cấu hình đăng nhập SSH Key (ed25519) và truyền file SCP/SFTP an toàn.

- Canonical HTML: https://thuecloud.vn/cai-dat-va-cau-hinh-openssh-server-windows-tren-windows-server-2022-vps
- Markdown URL: https://thuecloud.vn/cai-dat-va-cau-hinh-openssh-server-windows-tren-windows-server-2022-vps.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à khởi chạy OpenSSH Server bằng PowerShell
- Cấu hình đăng nhập không cần mật khẩu với SSH Key (ed25519)
- Bảng tổng hợp khác biệt OpenSSH Windows vs Linux
- Câu hỏi thường gặp (FAQ)
  - Tại sao tôi đã copy Public Key vào C:\Users\Administrator\.ssh\authorized_keys nhưng SSH vẫn đòi mật khẩu?
  - Cài OpenSSH Server trên Windows Server 2022 có dùng được WinSCP hoặc FileZilla để SFTP không?
  - Có thể đổi cổng 22 của OpenSSH Server Windows sang cổng khác để tránh bot quét không?

Quản trị [Windows Server 2022 VPS](https://thuecloud.vn/vps-viet-nam) không nhất thiết lúc nào cũng phải mở Remote Desktop (RDP) nặng nề. Microsoft đã tích hợp sẵn **OpenSSH Server** chính chủ ngay trong Windows Server, cho phép bạn mở terminal PowerShell từ xa, chạy lệnh triển khai tự động (CI/CD) và truyền tải file qua `scp`/`sftp` nhanh gọn, an toàn tương tự máy chủ Linux.

> **Tóm tắt nhanh (TL;DR):**
> - **Cài đặt trong 10 giây:** Dùng lệnh `Add-WindowsCapability` trong PowerShell (không cần phần mềm bên thứ ba như Bitvise hay FileZilla Server).
> - **Điểm khác biệt quan trọng với Linux:** Với tài khoản thuộc nhóm `Administrators`, OpenSSH Windows không đọc file `~/.ssh/authorized_keys` mà đọc file `C:\ProgramData\ssh\administrators_authorized_keys`.
> - **Chuẩn bảo mật:** Bật dịch vụ `sshd` tự khởi động, chỉ mở cổng `22` cho IP tin cậy/VPN và tắt đăng nhập bằng mật khẩu sau khi đã test SSH Key thành công.
> - *Cập nhật: 11/2026*

## 1. Cài đặt và khởi chạy OpenSSH Server bằng PowerShell

Mở PowerShell với quyền Administrator trên Windows Server 2022 VPS và thực thi:

```powershell
# Kiểm tra và cài đặt OpenSSH Server
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0

# Khởi động dịch vụ và đặt tự động chạy khi reboot VPS
Start-Service sshd
Set-Service -Name sshd -StartupType 'Automatic'

# Mở cổng 22 trên Windows Firewall (nên giới hạn RemoteAddress nếu dùng IP tĩnh)
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 khi SSH vào (thay vì `cmd.exe` cũ):

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

## 2. Cấu hình đăng nhập không cần mật khẩu với SSH Key (`ed25519`)

Đây là bước nhiều người làm sai nhất trên Windows vì quen thói quen của Linux. Nếu bạn đăng nhập bằng user `Administrator`, hãy dán khóa công khai (`id_ed25519.pub`) vào file `C:\ProgramData\ssh\administrators_authorized_keys` và sửa quyền ACL chuẩn (bắt buộc chỉ `SYSTEM` và `Administrators` có quyền đọc):

```powershell
# Tạo file và phân quyền ACL chặt chẽ cho administrators_authorized_keys
$keyPath = "C:\ProgramData\ssh\administrators_authorized_keys"
Add-Content -Path $keyPath -Value "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI... your_key"

icacls.exe $keyPath /inheritance:r /grant "Administrators:F" /grant "SYSTEM:F"
```

Sau khi kiểm tra đăng nhập `ssh Administrator@<IP_VPS>` thành công bằng SSH Key, bạn có thể sửa `C:\ProgramData\ssh\sshd_config` đặt `PasswordAuthentication no` rồi chạy `Restart-Service sshd`.

## 3. Bảng tổng hợp khác biệt OpenSSH Windows vs Linux

| Thành phần | Trên Linux (Ubuntu/AlmaLinux) | Trên Windows Server 2022 |
| :--- | :--- | :--- |
| **File cấu hình `sshd`** | `/etc/ssh/sshd_config` | `C:\ProgramData\ssh\sshd_config` |
| **File Key cho Admin/Root** | `/root/.ssh/authorized_keys` | `C:\ProgramData\ssh\administrators_authorized_keys` |
| **Quản lý quyền file Key** | `chmod 600` | `icacls /inheritance:r /grant ...` |
| **Truyền file từ xa** | `scp` / `sftp` | `scp` / `sftp` hoạt động y hệt (dùng đường dẫn `/C:/...`) |

Nếu bạn đang dùng Windows VPS để cài đặt các hệ thống tự động hóa, đừng bỏ qua bài [cài đặt Redis Object Cache tăng tốc WordPress trên DirectAdmin](https://thuecloud.vn/directadmin-tren-vps-cach-cai-redis-object-cache-tang-toc-wordpress) hoặc [bảo mật API Key, xác thực 2FA và cô lập Docker Sandbox cho AnythingLLM](https://thuecloud.vn/anythingllm-huong-dan-bao-mat-api-key-xac-thuc-2fa-va-co-lap-docker-sandbox). Xem thêm giải đáp thắc mắc về Windows VPS tại [trang FAQ](https://thuecloud.vn/faq).

---

> **Trải nghiệm Windows Server 2022 VPS mượt mà trên KVM Enterprise NVMe tại ThueCloud.Vn:**
> - **Tối ưu cả RDP lẫn OpenSSH:** Hạ tầng NVMe Enterprise tại `vn-hn` giúp thao tác PowerShell, `scp`/`sftp` và triển khai ứng dụng trên Windows Server nhanh như máy chủ Linux.
> - **Chi phí hợp lý:** Dễ dàng lựa chọn từ **VPS VN 2 (78.000đ/tháng năm hoặc 90.000đ/tháng)** hoặc **VPS VN 3 (139.000đ/tháng năm hoặc 170.000đ/tháng)** — VAT **0%**, SLA **99,9%**, hoàn tiền **07 ngày**.
> - Xem chi tiết cấu hình tại [bảng giá Cloud VPS](https://thuecloud.vn/pricing).

---

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

### Tại sao tôi đã copy Public Key vào `C:\Users\Administrator\.ssh\authorized_keys` nhưng SSH vẫn đòi mật khẩu?
Theo thiết kế bảo mật của OpenSSH trên Windows, mọi tài khoản thuộc nhóm `Administrators` sẽ bỏ qua file trong thư mục cá nhân và chỉ kiểm tra `C:\ProgramData\ssh\administrators_authorized_keys`. Ngoài ra, quyền ACL của file này không được phép kế thừa từ thư mục cha.

### Cài OpenSSH Server trên Windows Server 2022 có dùng được WinSCP hoặc FileZilla để SFTP không?
Hoàn toàn được. Ngay khi dịch vụ `sshd` chạy trên cổng `22`, bạn có thể dùng WinSCP, FileZilla hoặc lệnh `sftp` chuẩn để truyền file mã hóa an toàn mà không cần cài thêm FTP Server.

### Có thể đổi cổng 22 của OpenSSH Server Windows sang cổng khác để tránh bot quét không?
Có. Bạn mở file `C:\ProgramData\ssh\sshd_config`, bỏ dấu `#` ở dòng `Port 22` và đổi sang cổng mong muốn (ví dụ `Port 2222`), mở cổng mới trên Windows Firewall rồi chạy `Restart-Service sshd`.

## 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
- https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_server_configuration

---

## 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)
