I'm exploring OpenBSD and want to stick to its default shell, which is ksh. My goal is for my regular user ("bruno") and root user to have a shared history file. However, it seems that when running as root, ksh refuses to write to a HISTFILE that is owned by non-root user. This illustrates the issue:
$ echo $0
ksh
$ HISTFILE=/home/bruno/history
$ chmod 777 /home/bruno/history
$ echo test
test
$ cat /home/bruno/history
chmod 777 /home/bruno/history
echo test
cat /home/bruno/history
$ su
Password:
# HISTFILE=/home/bruno/history
# echo $HISTFILE
/home/bruno/history
# echo test2
test2
# cat /home/bruno/history
chmod 777 /home/bruno/history
echo test
cat /home/bruno/history
su
As you can see, the commands that are run as root do not appear in /home/bruno/history. Why won't root session in ksh write to the specified HISTFILE? If it is a ksh security feature, how do I turn it off?