• Về minhduy.vn
  • Đăng ký Hosting
  • Thiết kế Website
  • Khuyến mãi HOT
Hướng Dẫn Sử Dụng Dịch Vụ - Minh Duy Solutions
  • Trang chủ
  • Hosting
    • Hướng dẫn Hosting cPanel
    • Hướng dẫn Hosting DirectAdmin
  • Tên miền
  • Website
    • Hướng dẫn WordPress
    • Hướng dẫn Webmaster
  • Email Doanh Nghiệp
    • Office 365
    • Google Work Space
    • Email Zimbra
  • VPS – Máy chủ
    • Hướng dẫn Linux
    • Hướng dẫn DirectAdmin
  • Hướng dẫn chung
  • Góc ICT
No Result
View All Result
  • Trang chủ
  • Hosting
    • Hướng dẫn Hosting cPanel
    • Hướng dẫn Hosting DirectAdmin
  • Tên miền
  • Website
    • Hướng dẫn WordPress
    • Hướng dẫn Webmaster
  • Email Doanh Nghiệp
    • Office 365
    • Google Work Space
    • Email Zimbra
  • VPS – Máy chủ
    • Hướng dẫn Linux
    • Hướng dẫn DirectAdmin
  • Hướng dẫn chung
  • Góc ICT
No Result
View All Result
Hướng Dẫn Sử Dụng Dịch Vụ - Minh Duy Solutions
No Result
View All Result
Home Hướng dẫn máy chủ Hướng dẫn Linux

How to Change SSH Port on Linux

Minh Duy Solutions by Minh Duy Solutions
15/07/2024
Reading Time: 3 mins read
A A
0
ssh
475
SHARES
1.5k
VIEWS
Share on FacebookShare on Twitter

Contents

  1. About the SSH Port
  2. Changing the SSH Port

In today’s digital age, securing server access is more crucial than ever. One effective method to thwart potential attackers is by altering the default SSH port. This article provides a comprehensive guide on how to safely make this change, ensuring not only a fortified security stance but also uninterrupted server access.

About the SSH Port

SSH (Secure Shell) is a protocol used primarily for secure remote server access and management. When we talk about the “SSH port,” we’re referring to the network port number on which an SSH server listens for incoming connections. By default, SSH servers listen on port 22. However, for security reasons, many system administrators choose to change this default port to another, less predictable number to help protect against automated attacks. Though it’s not mean that this is enough for comprehensive security, additional measures. 

Changing the SSH Port

Changing the default SSH port on a Linux system can add an additional layer of security against automated attacks. Here’s a step-by-step guide to help you make the change:

1. Backup the Configuration File. Before making any changes, it’s always a good practice to back up your SSH configuration file.

sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.backup

2. Edit the SSH Configuration File. Open the SSHD configuration file with your preferred text editor. For this example, we’ll use nano.

sudo nano /etc/ssh/sshd_config

Sample Output:

Displaying the terminal command 'sudo nano /etc/ssh/sshd_config' followed by the GNU nano 6.2 editor interface.

3. Locate the Port Directive. Find the line that starts with Port. It should say Port 22 by default.

4. Change the Port Number. Edit the line to reflect your desired port number, preferably above 1024 to avoid conflicts with other standard services. For instance, to change it to port 2222, the line would look like:

Port 2222

5. Save and Close the File. If you’re using nano, press CTRL + O to write the changes, then press Enter, and CTRL + X to exit.

6. Adjust Firewall Rules. If you have a firewall enabled (like UFW or Firewalld), you’ll need to update its rules to allow connections on the new SSH port.

sudo ufw allow 2222/tcp

7. Restart the SSH Service. Apply the changes by restarting the SSH daemon.

sudo systemctl restart sshd

8. Test the New SSH Port. Before logging out of your current session, open a new terminal or SSH client and try connecting to the server using the new port to ensure everything works correctly:

ssh username@your_server_ip -p 2222

If you’re sure about your changes and the new port is working, and if you have a firewall enabled, consider closing the default port (22) to enhance security. Always be cautious when changing SSH settings, especially if you’re connecting remotely. Mistakes might lock you out of your server. Once you’re done, your Linux server will now accept SSH connections on the new port, enhancing its security against potential threats targeting the default port.

4.4/5 - (185 bình chọn)
Tags: linuxSSHchange port sshchange port
Share190Tweet119
Minh Duy Solutions

Minh Duy Solutions

Bài viết liên quan

thiet lap dung luong ram toi da cho redis 4629
Hướng dẫn Linux

Thiết lập dung lượng RAM tối đa cho Redis

11/06/2025
1.5k
huong dan cai dat socks5 tren vps linux 4583
Hướng dẫn máy chủ

Hướng dẫn cài đặt Socks5 trên VPS Linux

26/05/2025
1.5k
mot so lenh co ban kiem tra server khi bi ddos 4461
Hướng dẫn Linux

Một số lệnh cơ bản kiểm tra server khi bị DDoS

13/12/2024
1.5k
4454
Hướng dẫn Linux

Cách kiểm tra máy chủ Linux có bị tấn công DDOS hay không?

13/12/2024
1.5k
mount umount o cung hay thiet bi tren linux 4406
Hướng dẫn Linux

Mount / Umount Ổ Cứng Hay Thiết Bị Trên Linux

30/10/2024
1.5k
20 vi du ve crontab tren he dieu hanh linux 4352
Hướng dẫn Linux

20 ví dụ về crontab trên hệ điều hành Linux

24/09/2024
1.5k

Để lại một bình luận Hủy

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

No Result
View All Result

Recommended.

facebook-chat-page

Hướng dẫn tích hợp Facebook chat vào website

22/09/2021
1.6k
phan tu cua wordpress 1

Xử lý lỗi không đăng bài viết khi lên lịch trên WordPress

15/06/2023
1.6k

Trending.

cach tao doi quoc gia cho tai khoan google 4082

Cách tạo (đổi quốc gia) cho tài khoản Google

24/01/2024
24.2k
cach tao doi quoc gia cho tai khoan google 4082

Cách xóa hồ sơ thanh toán tài khoản Google

24/01/2024
5.5k
57acc582dde37df0a76107d2fb2448d8

Cách Ngắt Link Ảnh Trong Adobe Illustrator, Đơn Giản, Hiệu Quả

04/10/2022
16.1k
Microsoft Support and Recovery Assistant

Hướng dẫn gỡ bỏ tận gốc Microsoft Office ra khỏi máy tính bằng phần mềm của Microsoft

22/07/2024
2.4k
cach sua loi co ve nhu ban o quoc gia khac voi nguoi quan ly gia dinh google 4097 3

Cách sửa lỗi Có vẻ như bạn ở quốc gia khác với người quản lý gia đình Google

24/01/2024
2.8k
Wiki Minh Duy Solutions

WIKI.MINHDUY.VN

Chuyên trang hướng dẫn sử dụng dịch vụ của Minh Duy Solutions

DMCA.com Protection Status

Danh mục

  • aaPanel
  • Góc ICT
  • Thiết Kế Đồ Hoạ
  • SEO
  • Hướng dẫn WHMCS
  • Hướng dẫn Hosting
  • Hướng dẫn WordPress
  • Email Zimbra
  • Hướng dẫn DirectAdmin
  • Hướng dẫn Hosting cPanel
  • Office 365
  • Hướng dẫn Website
  • Hướng dẫn Linux
  • Hướng dẫn Hosting DirectAdmin
  • Google Work Space
  • Hướng dẫn Webmaster
  • Hướng dẫn máy chủ
  • Hướng dẫn Email Doanh Nghiệp
  • Hướng dẫn Tên miền
  • Hướng dẫn chung
  • Uncategorized

Thẻ

AFC apt-get update apt-get upgrade category chủ thể cPanel debian DirectAdmin email doanh nghiệp Environment Variables giải nén Google Workspace G Suite hosting ioncube khôi phục mật khẩu linux nginx nmap nodejs npm Office 365 OneDrive Outlook out of memory path Paypal phpmyadmin SMTP. GMail SSH sudo swap Symbolic Link tar tar.gz thông báo tên miền tên miền ubuntu user whois WooCommerce WordPress wordpress cơ bản wp rocket Zimbra
  • Về minhduy.vn
  • Đăng ký Hosting
  • Thiết kế Website
  • Khuyến mãi HOT

Copyright © 2021 Hướng dẫn Minh Duy Solutions

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In

Add New Playlist

×
    No Result
    View All Result
    • Trang chủ
    • Hosting
      • Hướng dẫn Hosting cPanel
      • Hướng dẫn Hosting DirectAdmin
    • Tên miền
    • Website
      • Hướng dẫn WordPress
      • Hướng dẫn Webmaster
    • Email Doanh Nghiệp
      • Office 365
      • Google Work Space
      • Email Zimbra
    • VPS – Máy chủ
      • Hướng dẫn Linux
      • Hướng dẫn DirectAdmin
    • Hướng dẫn chung
    • Góc ICT

    Copyright © 2021 Hướng dẫn Minh Duy Solutions