分类目录归档:日志

centos 新增管理员并禁用root登陆

adduser 123
passwd 123
;;添加账号并设置密码

nano /etc/passwd
123:x:500:500:keaising:/home/keaising:/bin/bash
修改后
123:x:0:500:keaising:/home/keaising:/bin/bash
把500改为0 保存

nano /etc/ssh/sshd_config
#PermitRootLogin yes
改为
PermitRootLogin no
;限制root登陆

centos 使用youtube-dl下载高清ytb

yum install epel-release -y
yum update -y

yum install python youtube-dl -y

1) CentOS 7
rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm

2) CentOS 6
rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
rpm -Uvh http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-2.el6.nux.noarch.rpm

yum install ffmpeg ffmpeg-devel -y

youtube-dl -F URL  显示下载信息并不下载 …

Fail2ban启动失败分析,secure没有日志分析

Fail2ban启动失败提示没有日志,查看配置文件/etc/fail2ban/jail.local,日志路径为/var/log/secure,发现secure不存在

通过搜索,安装syslog,发现定向到systemd已经安装,然后继续搜索,安装rsyslog,重启rsyslog,日志出来,重装Fail2ban,顺利

yum install rsyslog -y
service rsyslog restart

一键Fail2ban

项目https://github.com/FunctionClub/Fail2ban

安装

wget https://raw.githubusercontent.com/FunctionClub/Fail2ban/master/fail2ban.sh && bash fail2ban.sh

卸载

wget https://raw.githubusercontent.com/FunctionClub/Fail2ban/master/uninstall.sh && bash uninstall.sh

clear
#CheckIfRoot
[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }


#ReadSSHPort
[ -z "`grep 

修改wp 邮件模板 防止国产邮箱重置密码无效

修改注册用户 去掉<>

修改WP根目录下的 wp-login.php文件,将

$message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . ">\r\n";

替换为

$message .=network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . "\r\n";

注册信息

打开WP安装目录下的/wp-includes/pluggable.php,找到如下代码(1741行左右)

$message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user->user_login), 'login') . ">\r\n\r\n"

nginx反向代理设置

1. 同域名

server { 
listen 80; 
server_name dd.ylx.me;
#include /etc/nginx/conf/ddos2.conf;

location / {
	#设置主机头和客户端真实地址,以便服务器获取客户端真实IP
	proxy_set_header Host $host;	
	proxy_set_header X-Real-IP $remote_addr;
	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	#禁用缓存
	proxy_buffering off;
	#设置反向代理的地址,更换你的后端IP
	proxy_pass http://203.114.74.45;
      }
access_log off; 
} 

2.不同域名,不带缓存目录

server { 
listen 80; 
server_name windowsupdate.chuyu.me