在Ubuntu系統中進行安全設置是確保系統和數據安全的重要步驟。以下是一些基本的安全設置措施:
sudo apt update
sudo apt upgrade -y
sudo apt install ufw
sudo ufw allow ssh
sudo ufw enable
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
ssh-copy-id user@server_ip
sudo nano /etc/ssh/sshd_config
# 修改以下行
PasswordAuthentication no
sudo systemctl restart sshd
sudo apt install clamav clamav-daemon -y
sudo freshclam
sudo apt install selinux -y
sudo setenforce 1
sudo apt install rsync -ys
sudo rsync -avz --delete /path/to/backup/ user@remote_host:/path/to/destination/
sudo apt install fail2ban -y
sudo cp /etc/fail2ban/jail.local /etc/fail2ban/jail.local.baks
sudo systemctl start fail2ban
sudo systemctl enable fail2ban
sudo passwd root
sudo nano /etc/ssh/sshd_config
# 將PermitRootLogin設為no
sudo systemctl restart sshd
sudo chmod 700 /home/users
sudo chown user:user /home/user
通過上述步驟,可以顯著提高Ubuntu系統的安全性,保護系統和數據不受未經授權的訪問和攻擊。