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

Eric Krohn krohn at cellar.bae.bellcore.com
Thu Feb 14 02:21:47 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.  This will, I assume, force Ksh to keep
|> >a history of my session in core (since I can still walk through my commands).
|> 
|> 	Yes, it happened to me, too!  I had given up using su(1), and just
|> logged out and back in when needing root powers.  This was with the new ksh
|> from the fixdisk2.0.  
	....
|> After getting the new ksh from osu-cis, and verifying that it fixed
|> the Cnews problem, I tried the su, just for fun, and was overjoyed to find
|> that problem fixed.

Getting a working ksh is obviously the preferred solution.
However, I've also used a technique of switching HISTFILE based on user name
(even with a working ksh :-).
I run 
	su cplus -c "exec $bin/myksh"
where myksh runs id(1) to get the new user name and does
	HISTFILE=$HOME/history/$ID exec ksh

I will also do
	HISTFILE=$HOME/history/parser exec ksh
when I want to work on my parser.

Advantages:
* different user IDs use different history files (my $HOME/history
	directory is mode 777), so no permission problems.
* different user IDs and projects maintain different saved history.
	When I'm root, or cplus, I usually want to run different commands
	than when I'm me.  When I'm working on my parser, I want to search 
	for the make command germane to it rather than some other make for 
	a different piece of software.

Disadvantages:
* You cannot share history file contents.  (That's what cut and paste are for!)

-- 
Eric J. Krohn
krohn at bae.bellcore.com  or  uunet!bellcore!bae!krohn
Bell Communications Research,	444 Hoes Ln,    Piscataway, NJ 08854



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