linux ssh 不保存操作记录history
来源:互联网 发布:float在c语言中的意思 编辑:程序博客网 时间:2024/06/06 03:29
转自http://blog.csdn.net/liushu_it/article/details/43835709
“Sanr” 博客,请务必保留此出处http://0x007.blog.51cto.com/6330498/1637909
————————————————
1)history -c //是把Linux下的/root/.bash_history 全给清了,实现不保存,作为黑客是不地道的。再从其他终端倒腾回去:
history |awk -F" " '{if(NR>0){$1="";print $0}}'|grep -v "multepollserver" > /root/.bash_history
2)不留痕迹的办法,把指向给修改到/dev/null下:
[root@localhost ~]# echo $HISTFILE
/root/.bash_history
[root@localhost ~]# HISTFILE=/dev/null
[root@localhost ~]# echo $HISTFILE
/dev/null
[root@test ~]# vi /root/.bash_history
对前面的:history |awk -F" " '{print $3}' > /root/.bash_history 删除,退出即可。
请教一个关于linux下不保存命令历史记录的问题,不需要在任何文件中设置:
ssh 登陆之后,在命令行下运行
set HISTIGNORE=*
或者
export HISTIGNORE=*
以后的命令就不会被保存了。
最方便的命令
unset HISTORY HISTFILE HISTSAVE HISTZONE HISTORY HISTLOG; export HISTFILE=/dev/null; export HISTSIZE=0; export HISTFILESIZE=0
在.bashrc的最后行追加
unset HISTFILE
这样做终端历史记录还是保存到了.bash_history文件中,只是新打开的终端不能直接用上键调用而已,用"cat .bash_history"仍能查看历史记录
cat .bash_history 看到的历史记录是 unset HISTFILE 之前保留的命令.
unset HISTFILE 之后的命令并没有保留.
用 history -c 清空历史命令.
步骤如下:
1、建立一个文件来存储常用命令,例如/root/history.txt,把常用命令当成文本写进去,每个命令占一行
2、在终端运行history -c,清除杂乱的历史记录
3、运行history -r /root/history.txt,把命令读进来作为当前bash的历史记录
4、运行history,就得到一个整洁的命令列表了,例如:
[root@localhost windata]# history -c
[root@localhost windata]# history -r /root/history.txt
[root@localhost windata]# history
1 history -r /root/history.txt
2 mount -t msdos -o iocharset=gb2312 /dev/sda1 /mnt/usb
3 mount -t vfat -o iocharset-gb2312 /dev/hda5 /mnt/windata
4 umount /mnt/windata
5 mount -t vfat -o iocharset-gb2312 /dev/hda5 /mnt/windata
6 cd /mnt/windata
7 history
[root@localhost windata]#
5、以后命令乱了,重复1-4的步骤,又可以使命令很清晰了。
可以用history命令来查看。
其它的记录你在/var/log这个文件夹下去找吧。它记录了所有的记录。
实际上。history命令也是读的/var/log的东西
历史命令都在 .bash_history 文件中呀,每个用户的家目录中都有这个文件的,去看他们的历史命令吧
在每个用户的家目录里,看文本命令很多,如: cat \ more \ less \ vi 等等这些命令都可以看某个用户的 .bash_history 文件。
例:# more ~user/.bash_history 看 user 用户的历史命令,但是你要访问的权限才行。
.bash_history在每个用户的$HOME下
在每个用户的home目录下的.bash_history
6.把一些命令给去掉回写回/root/.bash_history的方法:
- history |awk -F" " '{if(NR>0){$1="";print $0}}'|grep -v "multepollserver" > /root/.bash_history
阅读全文
0 0
- linux ssh 不保存操作记录history
- ubuntu linux ssh 操作记录
- 不记录history及清除history
- linux 添加 history 记录
- linux 下记录ssh的操作日志
- CentOS-解决CentOS 7 history命令不显示操作记录的时间和用户身份问题
- 常用linux操作history列表
- SSH退出时保存历史命令(History)
- 9.3.3 记录用户操作:history
- Linux下查看用户登陆后的操作记录及history命令显示时间
- Linux下查看用户登陆后的操作记录及history命令显示时间
- Linux下查看用户登陆后的操作记录及history命令显示时间
- Linux命令——history查看用户操作记录及时间
- 设置linux系统history相关变量,命令时间、保存history条数,多session共享history
- linux中记录详细的history
- linux history记录加时间戳
- Linux History记录加时间戳实用技巧
- linux下history日志记录脚本
- 为什么内存映射要比IO读写更加快速
- 2017.11.01前端小记
- ZOJ 3983 && 2017CCPC秦皇岛 C:Crusaders Quest
- LeetCode基础-排序-快速排序
- 微信小程序布局(一)
- linux ssh 不保存操作记录history
- 从源代码构建VIM
- MyBatis配置数据源的两种方式
- 第四章:表达式和运算符
- 对linux内核、用户空间、内核态、用户态的理解
- jqurey常用方法(jqurey设计思想)
- 【安全牛学习笔记】http响应状态码大全
- 对实体类的CRUD操作
- mysql