su and/or ksh change history file's group and ownership

Kris A. Kugel kak at hico2.UUCP
Fri Feb 15 09:44:06 AEST 1991

In article <1991Feb12.055727.23183 at>, amir at (Amir Sadr) writes:
[ksh with su turns off the user's permission to write ksh history]

I always find it a pain to go back to the old shell now that I'm used to ksh.

Yes, I've had this problem.  As a result, I've got the root default shell
(in /etc/passwd) set to /bin/sh, since that won't change history.
The culprit is the HISTFILE variable, you have to change that
before you su.  Maybe something like this:

"HISTFILE=/tmp/.suhistory /bin/su"

I have a vague recollection that this will spawn off the command
with the HISTFILE variable changed in its environment, but will
not change HISTFILE in the current environment.

*  *  *  *  *  *  *  *  *  *  (two minutes pass) *  *  *  *  *  *  *  *  *  *

I just tried something similar to this,
	"HISTFILE=/tmp/.suhistory /bin/su root -c ksh"
	(some futzing to get ksh instead of sh for my su)
This didn't change HISTFILE in the current environment,
didn't change my history file permissions or ownership
but did keep a history (numbered from one)

maybe you can alias su to the earlier verion above and use su'd ksh that way.

Jeez, thanks for asking, I'd just been living with the sub-optimal /bin/sh
solution up to now.  Now, I've got something better . . . .

                               Kris A. Kugel
                             ( 908 ) 842-2707
                      internet: kak at

More information about the Comp.sys.3b1 mailing list