su and/or ksh change history file's group and ownership
Jon H. LaBadie
jon at jonlab.UUCP
Sat Feb 16 19:04:26 AEST 1991
In article <1991Feb13.005632.19801 at ceilidh.beartrack.com>, dnichols at ceilidh.beartrack.com (DoN Nichols) writes:
> In article <1991Feb12.055727.23183 at ms.uky.edu> amir at s.ms.uky.edu (Amir Sadr) writes:
> >I've just noticed that during Ksh, becoming super user via /bin/su will
> >change the owner and group ID of $HISTFILE (in my case $HOME/.kshistory)
> >to root. Once I become a regular user again, the group and owner ID of the
> >history file however remain as root.
> >
> Yes, it happened to me, too! I had given up using su(1), and just
> logged out and back in when needing root powers.
> ... . I had read mention recently of
> the ksh on osu-cis being the better one to use for the unix-pc, so I snarfed
> it. (KSH+IN.Z) Not only did it execute the Cnews code properly, but it also
> didn't give the ownership change of .kshistory.
It may be preferable to get the osu-cis version of ksh, but for those
die hards who persist with the stock ksh, here is what I've done;
enter the following lines in your ksh environment file:
function uid {
typeset x y
x=`id`
y=${x%%'(*'}
echo ${y#uid=}
}
typeset -xf uid
trap ' [ `uid` = 0 ] &&
chown ${LOGNAME} ${HISTFILE:-${HOME}/.history}
' 0
It executes as you complete your 'su' session and changes ownership
of the history file back to yourself.
Jon
--
Jon LaBadie
{att, princeton, bcr, attmail!auxnj}!jonlab!jon
More information about the Comp.sys.3b1
mailing list