#!/bin/sh
grep HISTTIMEFORMAT /etc/bashrc || echo 'export HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S "' >>/etc/bashrc
for U in `grep -v shutdown /etc/passwd|awk -F: '$NF~/sh/&&$NF!~/no/{print $1}'`
do
UHOME=`cat /etc/passwd|grep "^$U"|cut -d: -f6`
[ ! -f $UHOME/.bash_history ] && touch $UHOME/.bash_history
chattr +a $UHOME/.bash_history
done
grep HISTTIMEFORMAT /etc/bashrc || echo 'export HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S "' >>/etc/bashrc
for U in `grep -v shutdown /etc/passwd|awk -F: '$NF~/sh/&&$NF!~/no/{print $1}'`
do
UHOME=`cat /etc/passwd|grep "^$U"|cut -d: -f6`
[ ! -f $UHOME/.bash_history ] && touch $UHOME/.bash_history
chattr +a $UHOME/.bash_history
done
0
干嘛要 chattr +a $UHOME/.bash_history呢?
我看到我的系统是没有任何特殊权限的喔
lsattr .bash_history
--------------- .bash_history
我看到我的系统是没有任何特殊权限的喔
lsattr .bash_history
--------------- .bash_history
0
系统自带当然没有,+a 是为了不让删只让增加。要不超过数量就会被挤掉
lyhabc 发表于 2016-3-13 09:42
干嘛要 chattr +a $UHOME/.bash_history呢?
我看到我的系统是没有任何特殊权限的喔
lsattr .bash_histor ...
系统自带当然没有,+a 是为了不让删只让增加。要不超过数量就会被挤掉
编辑回复