Ubuntu security

本文详细介绍如何通过修改配置文件来增强Linux系统的安全性,包括fstab、sshd_config和sysctl.conf等关键文件的设置,以及如何正确配置host.conf以防止IP欺骗。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、

vi /etc/fstab

tmpfs /run/shm tmpfs defaults,noexec,nosuid 0 0

 

2、
vi /etc/ssh/sshd_config

AllowUsers lhadmin@*.*.*.*

 

3、
vi /etc/sysctl.conf

# IP Spoofing protection 
net.ipv4.conf.all.rp_filter = 1 
net.ipv4.conf.default.rp_filter = 1 
# Ignore ICMP broadcast requests 
net.ipv4.icmp_echo_ignore_broadcasts = 1 
# Disable source packet routing 
net.ipv4.conf.all.accept_source_route = 0 
net.ipv6.conf.all.accept_source_route = 0   
net.ipv4.conf.default.accept_source_route = 0 
net.ipv6.conf.default.accept_source_route = 0 
# Ignore send redirects 
net.ipv4.conf.all.send_redirects = 0 
net.ipv4.conf.default.send_redirects = 0 
# Block SYN attacks net.ipv4.tcp_syncookies = 1 
net.ipv4.tcp_max_syn_backlog = 2048 
net.ipv4.tcp_synack_retries = 2 
net.ipv4.tcp_syn_retries = 5 
# Log Martians net.ipv4.conf.all.log_martians = 1 
net.ipv4.icmp_ignore_bogus_error_responses = 1 
# Ignore ICMP redirects 
net.ipv4.conf.all.accept_redirects = 0 
net.ipv6.conf.all.accept_redirects = 0 
net.ipv4.conf.default.accept_redirects = 0   
net.ipv6.conf.default.accept_redirects = 0 
# Ignore Directed pings 
net.ipv4.icmp_echo_ignore_all = 1

 

4、
vi /etc/host.conf

order bind,hosts
nospoof on
 

cat sources.list # deb cdrom:[Ubuntu 20.04.2.0 LTS _Focal Fossa_ - Release amd64 (20210209.1)]/ focal main restricted # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://us.archive.ubuntu.com/ubuntu/ focal main restricted ## Major bug fix updates produced after the final release of the ## distribution. deb http://us.archive.ubuntu.com/ubuntu/ focal-updates main restricted ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team. Also, please note that software in universe WILL NOT receive any ## review or updates from the Ubuntu security team. deb http://us.archive.ubuntu.com/ubuntu/ focal universe # deb-src http://us.archive.ubuntu.com/ubuntu/ focal universe deb http://us.archive.ubuntu.com/ubuntu/ focal-updates universe # deb-src http://us.archive.ubuntu.com/ubuntu/ focal-updates universe ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## multiverse WILL NOT receive any review or updates from the Ubuntu ## security team. deb http://us.archive.ubuntu.com/ubuntu/ focal multiverse # deb-src http://us.archive.ubuntu.com/ubuntu/ focal multiverse deb http://us.archive.ubuntu.com/ubuntu/ focal-updates multiverse # deb-src http://us.archive.ubuntu.com/ubuntu/ focal-updates multiverse ## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. deb http://us.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse ## Uncomment the following two lines to add software from Canonical's ## 'partner' repositor
03-23
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值