Hi I am able to log all the commands ran by a user on my ssh server using these lines in my /etc/profile.
whoami="$(whoami)@$(echo $SSH_CONNECTION | awk '{print $1}')"
export PROMPT_COMMAND='RETRN_VAL=$?;logger -p local3.debug "$whoami [$$]: $(history 1 | sed "s/^[ ]*[0-9]\+[ ]*//" ) [$RETRN_VAL]"'
now my problem is when i ssh into the server and then type sh/dash a new shell opens and nothing is logged after that, it only logs everything outside the sh shell.
i have tried putting the above code into $HOME/.profile and other files like .bash_profile .bashrc but no luck.
PS: The rbash shell is also logging the commands, but the sh and dash wont.