Linux安全设置

2025-11-22 18:22:06

1、删除系统特殊的的用户和组

1 userdel username

2 userdel adm

3 userdel lp

4 userdel sync

5 userdel shutdown

6 userdel halt

7 userdel news

8 userdel uucp

9 userdel operator

10 userdel games

11 userdel gopher

以上所删除用户为系统默认创建,但是在常用服务器中基本不使用的一些帐号,但是这些帐号常被黑客利用和攻击服务器。

12 groupdel username

13 groupdel adm

14 groupdel lp

15 groupdel news

16 groupdel uucp

17 groupdel games

18 groupdel dip

同样,以上删除的是系统安装是默认创建的一些组帐号。这样就减少受攻击的机会。

2、服务管理

关闭系统不使用的服务

1 chkconfig level 35 apmd off

2 chkconfig level 35 netfs off

3 chkconfig level 35 yppasswdd off

4 chkconfig level 35 ypserv off

5 chkconfig level 35 dhcpd off?

6 chkconfig level 35 portmap off

7 chkconfig level 35 lpd off

8 chkconfig level 35 nfs off

9 chkconfig level 35 sendmail off

10 chkconfig level 35 snmpd off

11 chkconfig level 35 rstatd off

12 chkconfig level 35 atd off??

3、定期更新系统

yum -y update,可以加入到cron job。

4、LAMP安全

系统文件权限

修改init目录文件执行权限

1 chmod -R 700 /etc/init.d/*

修改部分系统文件的SUID和SGID的权限

2 chmod a-s /usr/bin/chage

3 chmod a-s /usr/bin/gpasswd

4 chmod a-s /usr/bin/wall

5 chmod a-s /usr/bin/chfn

6 chmod a-s /usr/bin/chsh

7 chmod a-s /usr/bin/newgrp

8 chmod a-s /usr/bin/write

9 chmod a-s /usr/sbin/usernetctl

10 chmod a-s /usr/sbin/traceroute

11 chmod a-s /bin/mount

12 chmod a-s /bin/umount

13 chmod a-s /bin/ping

14 chmod a-s /sbin/netreport

5、修改系统引导文件

1 chmod 600 /etc/grub.conf

2 chattr +i /etc/grub.conf

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
相关推荐
  • 阅读量:70
  • 阅读量:37
  • 阅读量:38
  • 阅读量:39
  • 阅读量:183
  • 猜你喜欢