linux系统加固
2022/9/17 5:17:32
本文主要是介绍linux系统加固,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
检查口令最小长度 vim /etc/login.defs 设置 PASS_MIN_LEN 8 检查是否设置口令生存周期 vim /etc/login.defs 设置PASS_MAX_DAYS 90 检查设备密码复杂度策略 vim /etc/pam.d/system-auth 追加到password requisite pam_cracklib.so后面(ucredit=-1 lcredit=-1 dcredit=-1) password requisite pam_cracklib.so ucredit=-1 lcredit=-1 dcredit=-1 检查是否限制用户su到root vim /etc/pam.d/su 在开头添加下面两行: auth sufficient pam_rootok.so auth required pam_wheel.so group=wheel # 将用户添加组 usermod -G wheel gcs 检查是否设置文件与目录缺省权限 vim /etc/profile 在文件/etc/profile中设置umask 027或UMASK 027, 如果文件中含有umask参数,则需要在最前面设置该参数 检查是否设置命令行界面超时退出 vim /etc/profile,增加 export TMOUT=300 source /etc/profile 检查是否限制root用户远程登录 cat /etc/ssh/sshd_config|grep PermitRootLogin vim /etc/ssh/sshd_config # 配置 PermitRootLogin no service sshd restart 检查是否配置远程日志功能 指定具体服务器ip vim /etc/rsyslog.conf rsyslog.*@192.168.212.1 检查FTP用户上传的文件所具有的权限 如果系统使用vsftp: 修改/etc/vsftpd.conf(或者为/etc/vsftpd/vsftpd.conf) vi /etc/vsftpd.conf 确保以下行未被注释掉,如果没有该行,请添加: write_enable=YES //允许上传。如果不需要上传权限,此项可不进行更改。 ls_recurse_enable=YES local_umask=022 //设置用户上传文件的属性为755 anon_umask=022 //匿名用户上传文件(包括目录)的 umask 重启网络服务 /etc/init.d/vsftpd restart 如果系统使用pure-ftp 修改/etc/pure-ftpd/pure-ftpd.conf vi /etc/pure-ftpd/pure-ftpd.conf 确保以下行未被注释掉,如果没有该行,请添加: umask 177:077 重启ftp服务 /etc/init.d/pure-ftpd restart 检查是否修改系统banner mv /etc/issue /etc/issue.bak mv /etc/issue.net /etc/issue.net.bak 检查FTP Banner设置 修改vsftp回显信息 vi /etc/vsftpd.conf(或/etc/vsftpd/vsftpd.conf) ftpd_banner=Authorized users only. All activity will be monitored and reported.” 可根据实际需要修改该文件内容。 重启服务: /etc/init.d/vsftpd restart 或者service vsftpd restart 检查是否启用SSH协议,禁用telnet协议 cat /etc/xinetd.d/telnet|grep disable vim /etc/xinetd.d/telnet #修改 disable = yes service xinetd restart
这篇关于linux系统加固的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-03-30[译]漫画SELinux概念
- 2024-03-29linux 移动文件
- 2024-03-28linux .so file
- 2024-03-28Linux 磁盘管理
- 2024-03-28Linux学习笔记(十三)磁盘管理(一):磁盘分区
- 2024-03-26linux 创建 文件
- 2024-03-25使用SecureCRT对Linux vim进行颜色设置
- 2024-03-202019-2020-12 20199317 《Linux内核原理与分析》 第十二周作业
- 2024-03-20Linux运维的第二周总结
- 2024-03-13how to count number of directories in linux