在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 -y
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/user
sudo chown user:user /home/user
通过以上步骤,可以显著提高Ubuntu系统的安全性。根据具体需求和环境,可能还需要进一步调整和优化这些安全措施。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读:Ubuntu VNC如何进行安全设置