1. Mở file key ssh lưu trên máy client
notepad $env:USERPROFILE\.ssh\known_hosts
2. Xóa hoặc thay đổi key trong file ssh trên notepad
Xóa bình thường sau đó lưu lại
3. Connect ssh tới server
ssh [user]@[host]
4. Mở port ra ngoài internet
1 - Kiểm tra UFW: sudo ufw status
2 - Nếu chưa bật: sudo ufw enable
3 - Mở port:
sudo ufw allow 80 // Mở port cụ thể
sudo ufw allow from 123.123.123.123 to any port 3306 //Mở cho ip cụ thể để an toàn hơn
sudo ufw allow 8000:9000 // Mở port theo dải
sudo ufw allow 22/tcp //Mở port kèm protocol
sudo ufw allow 8000:9000/tcp // Mở port theo dải kèm protocol
sudo ufw allow ssh //Mở port cho service
sudo ufw allow http //Mở port cho service
sudo ufw allow https //Mở port cho service
4 - Kiểm tra port đã mở
sudo ss -tuln //dùng để xem các port đang mở và đang lắng nghe
//Ý nghĩa từng tham số
ss : Socket Statistics (thay thế cho netstat)
-t : TCP
-u : UDP
-l : Listening (đang mở)
-n : Hiển thị số port (không resolve tên)
sudo ss -tuln | grep 80 //Lọc port cụ thể
5 - Cách đóng port
sudo ufw deny 3306 // Đóng port đang mở
sudo systemctl stop mysql // Dừng service đang mở port
sudo systemctl disable mysql // Disable service luôn
6 - Reload lại UFW
sudo ufw reload
Để lại một phản hồi