Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!rutgers!njin!princeton!jonlab!jon From: jon@jonlab.UUCP (Jon H. LaBadie) Newsgroups: comp.sys.3b1 Subject: Re: su and/or ksh change history file's group and ownership Summary: an environment file fix works with the old ksh Message-ID: <921@jonlab.UUCP> Date: 16 Feb 91 08:04:26 GMT References: <1991Feb12.055727.23183@ms.uky.edu> <1991Feb13.005632.19801@ceilidh.beartrack.com> Organization: 4455 Province Line Rd., Princeton, NJ 08540 Lines: 41 In article <1991Feb13.005632.19801@ceilidh.beartrack.com>, dnichols@ceilidh.beartrack.com (DoN Nichols) writes: > In article <1991Feb12.055727.23183@ms.uky.edu> amir@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