7

I have a linux box on amazon's aws EC2. I can view the user's bash_history here:

/home/ec2-user/.bash_history

However when I root in:

sudo -s

I do not get the root's bash_history. How can I view/find the bash_history for the admin user?

Thanks, Brett

4 Answers 4

10

Here's the quick way:

sudo less /root/.bash_history
0
5

You can run the history command to see the current users history.

1

When you "sudo -s", you apparently get the .bash_history of the source account, because $HOME is unchanged.

Try setting $HOME to ~root before you sudo -s.

1

Enable the logging within sudo, by inserting this with visudo

Defaults logfile=/var/log/sudo.log

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.