1753449 Members
6207 Online
108794 Solutions
New Discussion юеВ

Re: User history

 
SOLVED
Go to solution
mrk_1
Frequent Advisor

User history

Hi,

I want to check perticular user history. As I am root user, how do i check the user command history. I checked in .sh_history. But it shows only root user history.

Could any one help me pls?

Thanks.
12 REPLIES 12
V. Nyga
Honored Contributor

Re: User history

Hi,

user history is in the home directory of the user - there can't be root history ...

Volkmar
*** Say 'Thanks' with Kudos ***
mrk_1
Frequent Advisor

Re: User history

Hi,

I logged as a root, then switch to perticular user and gave cat .sh_history command. But it showing permission denied. I was wondering to see it.

Thanks.
V. Nyga
Honored Contributor

Re: User history

Hi again,

should be no problem for the root user ...
can you copy it or change permissions?

What os do you have?

V.
*** Say 'Thanks' with Kudos ***
mrk_1
Frequent Advisor

Re: User history

Hi Nyga,

Thanks lot. I can see it using change the file permission . Is it possible to see the time also. I can see all the command without time.

Thanks.
V. Nyga
Honored Contributor

Re: User history

Hi,

no, not with this shell feature - it only saves the commands.
You should have to search for scripts for doing this (maybe like echo the date then read changes of the history)

V.
*** Say 'Thanks' with Kudos ***
mrk_1
Frequent Advisor

Re: User history

Thanks V. I will try to wirte a script to find out the sol.
Thanks lota gain.
Court Campbell
Honored Contributor

Re: User history

as root just cat or grep /home/username/.sh_history or just do then all at once /home/*/.sh_history
"The difference between me and you? I will read the man page." and "Respect the hat." and "You could just do a search on ITRC, you don't need to start a thread on a topic that's been answered 100 times already." Oh, and "What. no points???"
mrk_1
Frequent Advisor

Re: User history

Hi Campbell,

Thanks lot . I Could see the history from cat /home/username/.sh_history also.

Thanks.
Deepak Kr
Respected Contributor

Re: User history

Hi Ram,

Try this:

HISTFILE=/var/adm/crash/history/.sh_history.$LOGNAME
readonly HISTFILE
export HISTFILE
print -s "LOGIN - `date '+%m-%d-%E-%H:%M'`"
HISTSIZE=1000
export HISTSIZE



"There is always some scope for improvement"