Home  >  Article  >  Operation and Maintenance  >  Linux server security tips

Linux server security tips

不言
不言Original
2019-03-18 15:55:373066browse

预防黑客和服务器安全是系统管理服务的主要任务。下面是一些Linux server security tips服务器的基本安全提示。

Linux server security tips

1、强密码策略

设置强密码是保护服务器安全的第一步。不要使用普通名称作为密码,如姓名、出生日期、手机号码等。密码应为字母数字,并带有大小写字母。

您可以在Linux server security tips机器上使用密码老化策略强制用户定期更改那里的密码。

例子:

获取密码老化信息

#chage -l username

更改密码老化信息

# chage -m 7 -M 60 -W 15 username
-m: Minimum number of days between password change
-M: Maximum number of days between password change
-W: Number of days of warning before password expires

禁用密码老化(不建议在生产服务器上使用)

# chage -M 99999 username

2、禁用root登录

root帐户拥有无限的特权,所以请在服务器上保持禁用root帐户。同时确保没有其他用户使用下面的命令,uid或gid 0,只有root用户行应该同时列出这两个命令。

# awk -F: '($3 == "0") {print}' /etc/passwd
# awk -F: '($4 == "0") {print}' /etc/passwd

要执行root级别命令,可以在服务器上配置sudo权限。

3、保持系统最新

始终使用最新的软件补丁或更新来保持系统最新状态。您可以使用Linux server security tips实用程序(yum,apt-get等)来更新最新的系统。确保定期更新系统。

例如:

# yum update
or
# apt-get update && apt-get upgrade

还可以使用yum-updatesd服务在发现任何新更新时启用电子邮件通知。

4、使用安全协议进行远程访问

从远程或传输数据访问服务器都要使用安全协议。所有的安全协议都是加密数据传输。

不使用:

> rcp 
> telnet 
> ftp

使用

> ssh 
> scp 
> sftp(基于SSL的FTP)

5、禁用不需要的服务

系统中有许多服务在后台运行。找出并禁用所有不需要的服务。

查找系统启动时将启动的所有服务

# chkconfig --list | grep ':on'

停止服务器上不需要的所有服务。

# service service-name stop

禁用服务以在系统引导时启动

# chkconfig service-name off

本篇文章到这里就已经全部结束了,更多其他精彩内容可以关注php中文网的其他相关栏目教程!!!

The above is the detailed content of Linux server security tips. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn