Sunday, April 28, 2024
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 16887  / 3 Years ago, tue, september 14, 2021, 10:30:20

On a few of my ubuntu installations, when I run sudo su and become sudo user, I can type history and view a list of commands run as sudo user. However, on my one ubuntu installation, for some reason when I run sudo su and type history, I just get this:



$ sudo su
# history
1 history


But I know for certain that a lot of commands were run as sudo user, but when I ssh out and ssh back into my ubuntu server, they do not display, like how they do on the other servers. Do I have some switch or something disabled on this one server? How can I regain access to view the history of commands run as sudo user?


More From » command-line

 Answers
7

Some possibilities why you do not keep shell history:




  • Your root shell is not /bin/bash but /bin/sh (symlinked to /bin/dash). Change this with the chsh command.

  • The filesystem where /root resides is mounted read-only, so the history file cannot be written.

  • The variable HISTFILE is set to a value other than /root/.bash_history. An empty file disables history, other values are used as location to write the history to.


[#28138] Thursday, September 16, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ularousand

Total Points: 380
Total Questions: 109
Total Answers: 101

Location: England
Member since Tue, Sep 8, 2020
4 Years ago
;