
centos7修改root用户密码
# passwd
//更改用户 root 的密码 。
//新的 密码:
//如果出现:
BAD PASSWORD: The password fails the dictionary check - it is based on a dictionary word
//修改这个文件:
vi /etc/security/pwquality.conf
//将最后一行的字典文件路径注释掉
#dictpath =/usr/share/dict/common 保存退出
修改ssh端口可以查看这里:修改ssh-22端口
查看用户登录信息(成功登录)
# last //对应的日志文件/var/log/wtmp; 成功登录用户
root pts/0 192.168.0.10 Sat Sep 14 08:10 - 01:08 (16:57)
root pts/0 192.168.0.10 Fri Sep 13 11:13 - 00:37 (13:24)
root pts/6 192.168.0.10 Fri Sep 13 10:43 - 00:37 (13:54)
root pts/4 192.168.0.10 Fri Sep 13 10:42 - 00:37 (13:55)
root pts/5 192.168.0.10 Fri Sep 13 09:13 - 12:03 (02:50)
root pts/4 192.168.0.10 Fri Sep 13 09:13 - 10:04 (00:51)
root pts/3 192.168.0.10 Fri Sep 13 09:13 - 12:04 (02:51)
查看尝试登录信息(用户登录失败信息)
# lastb //对应的日志文件/var/log/btmp; 尝试登录信息
ubnt ssh:notty 68.183.100.47 Sun Mar 1 05:23 - 05:23 (00:00)
ubnt ssh:notty 68.183.100.47 Sun Mar 1 05:23 - 05:23 (00:00)
fake ssh:notty 68.183.100.47 Sun Mar 1 05:23 - 05:23 (00:00)
fake ssh:notty 68.183.100.47 Sun Mar 1 05:23 - 05:23 (00:00)
zhangxh ssh:notty 121.132.1.20 Sun Mar 1 05:21 - 05:21 (00:00)
zhangxh ssh:notty 121.132.1.20 Sun Mar 1 05:21 - 05:21 (00:00)
zhangbs ssh:notty 218.232.94.201 Sun Mar 1 05:10 - 05:10 (00:00)
zhangbs ssh:notty 218.232.94.201 Sun Mar 1 05:10 - 05:10 (00:00)
zhangck ssh:notty 121.132.1.20 Sun Mar 1 05:06 - 05:06 (00:00)
zhangck ssh:notty 121.132.1.20 Sun Mar 1 05:06 - 05:06 (00:00)
zhangwd ssh:notty 218.232.94.201 Sun Mar 1 04:54 - 04:54 (00:00)
zhangwd ssh:notty 218.232.94.201 Sun Mar 1 04:54 - 04:54 (00:00)
zhangey ssh:notty 121.132.1.20 Sun Mar 1 04:51 - 04:51 (00:00)
zhangey ssh:notty 121.132.1.20 Sun Mar 1 04:50 - 04:50 (00:00)
显示最近登录信息
# lastlog
用户名 端口 来自 最后登陆时间
root xxxxx 一 3月 30 09:13:13 +0800 2020
bin **从未登录过**
daemon **从未登录过**
adm **从未登录过**
lp **从未登录过**
sync **从未登录过**
shutdown **从未登录过**
halt **从未登录过**
mail **从未登录过**
operator **从未登录过**
games **从未登录过**
ftp **从未登录过**
nobody **从未登录过**
systemd-network **从未登录过**
dbus **从未登录过**
polkitd **从未登录过**
清除登陆系统成功的记录
# echo > /var/log/wtmp //此文件默认打开时乱码,可查到ip等信息
# last
清除登陆系统失败的记录
# echo > /var/log/btmp //此文件默认打开时乱码,可查到登陆失败信息
# lastb
Bash历史相关
#<空格>command //在执行命令时,指定Bash不保存执行历史
# history -r //清除当前登录session的历史
# history -cw //清除所有历史
清除历史执行命令
# history -c //清空历史执行命令
# echo > ./.bash_history //或清空用户目录下的这个文件即可
清除mysqld.log日志
# echo > /var/log/mysqld.log
# cat /var/log/mysqld.log
其他
1)/var/log/secure:记录登录系统存取数据的文件;例如pop3,ssh,telnet,ftp等都会记录在此.
2)/ar/log/wtmp:记录登录着的信息记录,被编码过,所以必须以last解析;
3)/var/log/messages :记录Linux操作系统常见的系统和服务错误信息
4)/var/log.boot.log:记录一些开机或者关机启动的一些服务显示的启动或者关闭的信息;
5)/var/log/maillog:记录邮件的存取和往来;
6)/var/log/cron:用来记录crontab这个服务的内容;
7)/var/log/httpd,/var/log/mysqld.log等等文件,记录几个不同的网络服务的记录文件;
8)/var/log/acpid , ACPI - Advanced Configuration and Power Interface,表示高级配置和电源管理接口。
9)/var/run/utmp 记录着现在登录的用户;
10)/var/log/lastlog 记录每个用户最后的登录信息;
11)/var/log/btmp 记录错误的登录尝试;
12)/var/log/dmesg内核日志;
13)/var/log/cpus CPU的处理信息;
14)/var/log/syslog 事件记录监控程序日志;
15)/var/log/auth.log 用户认证日志;
16)/var/log/daemon.log 系统进程日志;
17)/var/log/mail.err 邮件错误信息;
18)/var/log/mail.info 邮件信息;
19)/var/log/mail.warn 邮件警告信息;
20)/var/log/daemon.log 系统监控程序产生的信息;
21)/var/log/kern 内核产生的信息;
22)/var/log/lpr 行打印机假脱机系统产生的信息;