2022
我们一起努力

阿里云服务器端口,如何备份阿里云linux服务器

服务器安全

1、修改SSH登录端口,默认为22,修改为其他端口

vim /etc/ssh/sshd_config
#Port 22
Port 7279

保存,然后使用service sshd restart或者systemctl restart sshd.service重启服务。同时在阿里云安全组开放端口、白名单。

2、限制root和密码登录

使用命令 vim /etc/ssh/sshd_config修改配置文件将PermitRootLogin、PasswordAuthentication的值改成no,并保存,然后使用service sshd restart或者systemctl restart sshd.service重启服务。

3、增加history每个用户操作记录脚本

 vim /etc/profile

在配置文件中输入以下内容,然后source /etc/profile生效。

##############Setting for history##############
 history
 USER=`whoami`
 USER_IP=`who -u am i 2>/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'`
 if [ "$USER_IP" = "" ]; then
 USER_IP=`hostname`
 fi
 if [ ! -d /var/log/history ]; then
 mkdir /var/log/history
 chmod 777 /var/log/history
 fi
 if [ ! -d /var/log/history/${LOGNAME} ]; then
 mkdir /var/log/history/${LOGNAME}
 chmod 300 /var/log/history/${LOGNAME}
 fi
 export HISTSIZE=4096
 DT=`date +"%Y%m%d_%H:%M:%S"`
 export HISTFILE="/var/log/history/${LOGNAME}/${USER}@${USER_IP}_$DT"
 chmod 600 /var/log/history/${LOGNAME}/*history* 2>/dev/null

4、删除不必要的系统用户

5、设置尽可能复杂的口令密码

长度:16位以上,需包含数字、大小写字母、特殊字符

赞(0)
文章名称:《阿里云服务器端口,如何备份阿里云linux服务器》
文章链接:https://www.fzvps.com/80473.html
本站文章来源于互联网,如有侵权,请联系管理删除,本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。
图片版权归属各自创作者所有,图片水印出于防止被无耻之徒盗取劳动成果的目的。

评论 抢沙发

评论前必须登录!