I currently have a server set up to save Bash history for every user immediately in their respective home folders and I want to create a script that runs on a set interval that switches the current user and executes the "history" command.
I have tried all variants of both su and sudo in the command line but whenever I run the command "history" for another user in a script or usind su/do, I get no output whatsoever.
In scripts, I have tried all variants of both su and sudo, as well as:
su <user>
history
But all it does is open a shell with that user and doesn't return the output of "history".
I'm currently using RHEL6.9 with Bash 4.1.2.