查看登录历史记录
last
aulast
查看所有⽤户的最后登录记录
aulastlog
查看命令历史记录
history
cat ~/.bash_history
查看当前可登录的⽤户列表
cat /etc/passwd|grep -v “^\s*#”|grep -E -v
“/sbin/nologin|/bin/sync|/sbin/shutdown|/sbin/halt|/bin/false”|awk
-F ‘:’ ‘{print $1}’
查看当前所有的定时任务
for u in cat /etc/passwd|grep -v "^\s*#"|grep -E -v "/sbin/nologin|/bin/sync|/sbin/shutdown|/sbin/halt|/bin/false"|awk -F ':' '{print $1}'
do
crontab -u $u -l
done
查看ssh爆破记录(登录失败与登录成功)
#统计出现多少次登陆失败
cat /var/log/secure|grep " sshd"|grep “Failed password”|grep -E -o
“([^ ]+) from ([^ ]+) port”|awk ‘{print $1" "$3}’|sort -n|uniq -c|
sort -n -t 1 -r
#统计出现多少次登陆成功
cat /var/log/secure|grep ” sshd“|grep “Accepted password”|grep -E
-o “([^ ]+) from ([^ ]+) port”|awk ‘{print $1" "$3}’|sort -n|uniq -
c|sort -n -t 1 -r
查看⾃动启动配置
#备注:使⽤systemctl启动的话,需要检查rc-local服务是否启⽤,如⽆启⽤则⽆⾃动
启动配置
systemctl status rc-local
cat /etc/rc.local
1查看服务
chkconfig --list
systemctl list-unit-files|grep enabled
查看进程
ps axjf
查看登陆⽤户列表
w
注销⽤户
pkill -kill -t
#例⼦:pkill -kill -t pts/0
查看⽹络连接
#tcp⽹络连接
netstat -antlp
ss -atpnl
#udp⽹络连接
netstat -anulp
ss -aupnl
查看隐藏仅进程
str_pids="ps -A | awk '{print $1}'
";
for i in /proc/[[:digit:]]*;
do
if echo “
s
t
r
p
i
d
s
"
∣
g
r
e
p
−
q
s
‘
b
a
s
e
n
a
m
e
"
str_pids" | grep -qs `basename "
strpids"∣grep−qs‘basename"i”`;
then
:
else
echo “Rootkit’s PID:
(
b
a
s
e
n
a
m
e
"
(basename "
(basename"i”)";
fi
done
安装程序历史
cat /var/log/yum.log
2任务计划历史
cat /var/log/cron
启动记录
cat /var/log/boot.log
审计配置
auditctl -l
审计记录(命令执⾏记录)
cat /var/log/audit/audit.log|grep EXECVE
#查看所有关于root的审计记录
ausearch -ui root
查找特权⽂件
find -type f / -print|xargs ls -l|grep -E “^-[r-][w-](s|[Sx-][r-]
w-)”