CSIA AN
asked on
change HISTFILE for root user on AIX
We want to change history file for root user to "HISTFILE=/var/log/root_co mmands.log ", but it's not working properly.
All users, except root, will have their histrory file on "HISTFILE=$HOME/.history.$ LOGIN/.sh_ history.$L OGIN.$u.$w .$y.$d"
root user has disabled remote login from outside. The only way to get root is though sudo or su commands.
Once, a non-root user run "su -" to get root shell, no output for KSH's history go to /var/log/root_commands.log
Our environment files are:
/etc/environment
/etc/profile
/.profile
And /.kshrc
Why commands run by root are not gone to /var/log/root_commands.log ?
Thanks much!
All users, except root, will have their histrory file on "HISTFILE=$HOME/.history.$
root user has disabled remote login from outside. The only way to get root is though sudo or su commands.
Once, a non-root user run "su -" to get root shell, no output for KSH's history go to /var/log/root_commands.log
Our environment files are:
/etc/environment
TZ=NFT-1DFT,M3.5.0,M10.5.0
LANG=en_US
LOCPATH=/usr/lib/nls/loc
NLSPATH=/usr/lib/nls/msg/%L/%N:/usr/lib/nls/msg/%L/%N.cat:/usr/lpp/cics/msg/%L/%N:/usr/lpp/cics/msg/C/%N:/usr/lpp/cicssm/msg/en_US/%N
LC__FASTMSG=true
ODMDIR=/etc/objrepos
XL_DEFMSG=/usr/lib/nls/msg/%L
XL_BACKENDMSG=vacsmsg.cat
PATH=/usr/krb5/bin:/usr/krb5/sbin:/usr/java14/jre/bin:/usr/java14/bin:/usr/java5/jre/bin:/usr/java5/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/lpp/pd/bin:/usr/lpp/psf/bin:/opt/CA/eTrustAccessControl/bin:/usr/ezt/bin:/usr/vac/bin:/usr/vacpp/bin:/usr/ezt/bin:/opt/CA/SharedComponents/lib:/usr/lpp/cics/bin:/opt/pware64/bin
MANPATH=/usr/share/man/en_US
PDBASE=/var/pd
PPO_ENV_FILE=/usr/lpp/pd/bin/ppo.env
WSM_DOC_DIR="/usr/websm/http/com.ibm.websm.http.server_1.0.0"
WSM_CGI_DIR=
WSM_WS_CMD="startsrc -s http4websm"
XL_DEFMSG=/usr/lib/nls/msg/%L
XL_BACKENDMSG=vacsmsg.cat
HISTSIZE=4098
EXTENDED_HISTORY=ON
/etc/profile
trap "" 1 2 3
readonly LOGNAME
MAIL=/usr/spool/mail/$LOGNAME
MAILMSG="[YOU HAVE NEW MAIL]"
TERM_DEFAULT=lft
TERM=`termdef`
TERM=${TERM:-$TERM_DEFAULT}
if [ "$LC_MESSAGES" = "C@lft" -a "$TERM" != "lft" ]
then
unset LC_MESSAGES
fi
export LOGNAME MAIL MAILMSG TERM
trap 1 2 3
export TIMEOUT=0
export PS1='(${HOSTNAME}):[${LOGNAME}] ${PWD} -> '
export DER_DRIVER_PATH=/usr/idebug
DB2TOOLS=/opt/IBM
export DB2TOOLS
export EDITOR=vi
export TMOUT=7200
d=`date "+%H%M.%m%d%y"`
t=`tty | cut -c6-`
u=`ps -ef|grep "$t "|grep "\-ksh"|sort -k5|head -1|awk '{print $1}'`
w=`who -ms | awk '{print $NF}' | sed "s/(//g" | sed "s/)//g"`
y=`tty | cut -c6- | sed "s/\//-/g"`
mkdir $HOME/.history.$LOGIN 2>/dev/null
export HISTFILE=$HOME/.history.$LOGIN/.sh_history.$LOGIN.$u.$w.$y.$d
if [ -z "`echo $PATH`" ]
then
PATH="${CICSPATH}/bin"
else
PATH="${PATH}:${CICSPATH}/bin"
fi
export PATH
if [ -z "`echo $NLSPATH`" ]
then
NLSPATH="${CICSPATH}/msg/%L/%N:${CICSPATH}/msg/C/%N"
else
NLSPATH="${NLSPATH}:${CICSPATH}/msg/%L/%N:${CICSPATH}/msg/C/%N"
fi
export NLSPATH
if [ -z "`echo $LIBPATH`" ]
then
LIBPATH="${CICSPATH}/lib"
else
LIBPATH="${LIBPATH}:${CICSPATH}/lib"
fi
export LIBPATH
PATH="${PATH}:/usr/lpp/cicssm/bin"
export PATH
LIBPATH="${LIBPATH}:/usr/lpp/cicssm/lib"
export LIBPATH
NLSPATH="${NLSPATH}:/usr/lpp/cicssm/msg/en_US/%N"
export NLSPATH
WSPATH=$CICSPATH/supportpacks/webservices
if [ -z "`echo $CLASSPATH`" ]
then
CLASSPATH=$WSPATH/lib/xsd.resources.jar:$WSPATH/lib/xsd.jar:$WSPATH/lib/wsdl4j.jar:$WSPATH/lib/woden.jar:$WSPATH/lib/ecore.xmi.jar:$WSPATH/lib/ecore.jar:$WSPATH/lib/ecore.change.jar:$WSPATH/lib/cwsa.jar:$WSPATH/lib/common.resources.jar:$WSPATH/lib/common.jar:$WSPATH/lib/XmlSchema.jar:$WSPATH/lib/NamespaceContext.jar
export CLASSPATH
else
CLASSPATH=${CLASSPATH}:$WSPATH/lib/xsd.resources.jar:$WSPATH/lib/xsd.jar:$WSPATH/lib/wsdl4j.jar:$WSPATH/lib/woden.jar:$WSPATH/lib/ecore.xmi.jar:$WSPATH/lib/ecore.jar:$WSPATH/lib/ecore.change.jar:$WSPATH/lib/cwsa.jar:$WSPATH/lib/common.resources.jar:$WSPATH/lib/common.jar:$WSPATH/lib/XmlSchema.jar:$WSPATH/lib/NamespaceContext.jar
export CLASSPATH
fi
if [ -z "`echo $PATH`" ]
then
PATH=$WSPATH/bin
export PATH
else
PATH=${PATH}:$WSPATH/bin
export PATH
fi
export ENV=$HOME/.kshrc
mesg n
/.profile
TMOUT=7200
export HOSTNAME=$(hostname)
export PS1='(${HOSTNAME}):[${LOGNAME}] ${PWD} -> '
export PS1
set -o vi
export PATH=$PATH:/usr/opt/ifor/ls/os/aix/bin
export EXTSHM=ON
HISTFILE=/var/log/root_commands.log
export HISTFILE
And /.kshrc
export HISTFILE=/var/log/root_commands.log
Why commands run by root are not gone to /var/log/root_commands.log
Thanks much!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Yep, that's exactly what I wanted to say.
Thanks once more for the points!
wmp
Thanks once more for the points!
wmp
ASKER
So, it means "set -o nolog" avoid saving functions to .sh_history file.. is that ok?
Thanks once more