Chuyển đến nội dung

Cổng22— SSH / SFTP

OpenSSH mặc định lắng nghe trên TCP 22. Phân hệ SFTP truyền tệp qua SSH, không phải giao thức cũ được gán cổng 115.

Registry assignments, software defaults and local listeners are different things. A port number alone does not identify or secure a service.

Configuration and troubleshooting

Kiểm tra Port và ListenAddress trong sshd_config. Giữ phiên hiện tại và quyền truy cập bảng điều khiển trong khi xác minh thay đổi, rồi thử kết nối thứ hai trước khi ngắt kết nối.

Important limitations

Đổi cổng không thay thế được xác thực hoặc kiểm soát truy cập. Đừng tắt xác minh khóa máy chủ để né lỗi kết nối.

Read-only checks: run on the server host

Choose the commands for your OS. Check TCP and UDP separately. No result is not a lasting availability guarantee; inspect host and container separately.

Linux

sudo ss -ltnp 'sport = :22'

macOS

sudo lsof -nP -iTCP:22 -sTCP:LISTEN

Windows PowerShell

Get-NetTCPConnection -LocalPort 22 -State Listen

Sources and review

Sources checked on:

This review covers the explanations and sources on this page, not your device or every community software entry below.

Phần mềm sử dụng cổng này (3 phần mềm)

Community software entries: links are references, not individual verification.

OpenSSH

Secure remote login and file transfer protocol

PuTTY

Popular SSH client on Windows platform

SSH Secure Shell

SSH secure shell protocol

Gợi ý sử dụng

  • Trước khi sử dụng cổng 22, hãy xác nhận rằng không có dịch vụ nào khác đang chiếm cổng này
  • Nếu gặp xung đột cổng, hãy cân nhắc sử dụng cổng khác hoặc dừng dịch vụ đang chiếm cổng

Câu hỏi thường gặp

What is port 22 used for?

Port 22 sits in the File Sharing category. This page lists the registered purpose and the software commonly associated with it; to see what is actually listening on a specific machine, check the process with ss/netstat.

Is port 22 TCP or UDP?

The registered protocol on this page is TCP. The same number behaves independently on each protocol: TCP may be listening while UDP is idle, so check them separately.

How do I check if port 22 is in use?

On Linux: sudo ss -tlnp 'sport = :22' for an exact port match. On macOS: sudo lsof -nP -iTCP:22 -sTCP:LISTEN. On Windows PowerShell: Get-NetTCPConnection -LocalPort 22 -State Listen. A listener counts as confirmed only when you can see the bind address and process name; without root/admin you will not see other users' processes.

Is port 22 secure? Should I open it in my firewall?

A port number has no inherent security — it depends on whether the listening service is correctly configured and whether it needs exposure at all. Keep loopback/internal-only services firewalled; where public access is required, pair it with source restrictions, VPN or authentication. The caution section on this page lists port-specific risks.

Thông tin nhanh

Cổng
22
Giao thức
TCP
Danh mục
Chia sẻ tệp
Trạng thái sử dụng
3 phần mềm đang sử dụng

Bạn cần trợ giúp?

Nếu phát hiện thông tin sai hoặc cần bổ sung, vui lòng gửi thông tin chỉnh sửa.

Gửi thông tin chỉnh sửa