LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-27-2011, 10:23 AM   #1
nandu neerukonda
LQ Newbie
 
Registered: Jun 2011
Location: Pune
Posts: 18

Rep: Reputation: Disabled
Exclamation how to see the history of a particular user


How could root get the history of a particular user?
Is it possible to get if the user don't even have home directory??

If it is configured by default, how to configure it ?



Thnanks in advance
Nandu Neerukonda
 
Old 10-27-2011, 10:30 AM   #2
thezerodragon
Member
 
Registered: Apr 2009
Location: Paris, France
Distribution: Fedora 12 Constantine
Posts: 142

Rep: Reputation: 44
Quote:
get the history
by this you mean a list of their recent commands, correct?
 
Old 10-27-2011, 10:34 AM   #3
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,892
Blog Entries: 27

Rep: Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183
Hi,

Quote:
Originally Posted by nandu neerukonda View Post
How could root get the history of a particular user?
Is it possible to get if the user don't even have home directory??

If it is configured by default, how to configure it ?



Thnanks in advance
Nandu Neerukonda
Quote:
excerpt from 'man history;
history - GNU History Library

COPYRIGHT
The GNU History Library is Copyright (C) 1989-2002 by the Free Software Foundation, Inc.

DESCRIPTION
Many programs read input from the user a line at a time. The GNU History library is able to keep
track of those lines, associate arbitrary data with each line, and utilize information from pre-
vious lines in composing new ones.

HISTORY EXPANSION
The history library supports a history expansion feature that is identical to the history expan-
sion in bash. This section describes what syntax features are available.

History expansions introduce words from the history list into the input stream, making it easy to
repeat commands, insert the arguments to a previous command into the current input line, or fix
errors in previous commands quickly.

History expansion is usually performed immediately after a complete line is read. It takes place
in two parts. The first is to determine which line from the history list to use during substitu-
tion. The second is to select portions of that line for inclusion into the current one. The
line selected from the history is the event, and the portions of that line that are acted upon
are words. Various modifiers are available to manipulate the selected words. The line is broken
into words in the same fashion as bash does when reading input, so that several words that would
otherwise be separated are considered one word when surrounded by quotes (see the description of
history_tokenize() below). History expansions are introduced by the appearance of the history
expansion character, which is ! by default. Only backslash (\) and single quotes can quote the
history expansion character.
Please explain or clarify how the user you are speaking of is logging into the system?
 
Old 10-29-2011, 07:03 AM   #4
nandu neerukonda
LQ Newbie
 
Registered: Jun 2011
Location: Pune
Posts: 18

Original Poster
Rep: Reputation: Disabled
Yep, I mean the list of their recent used commands.

The scenario is a RHEL server is connected in a network of client systems with NT.
Users have accouts in server and login through putty to the server.
In case few users dont have a home directory.

Now, how could root get the list of commands used by a particular user.


thanks in advance
nandu neerukonda
 
Old 10-29-2011, 07:06 AM   #5
fukawi1
Member
 
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 190Reputation: 190
Code:
less /home/$username/.bash_history
 
Old 10-29-2011, 07:18 AM   #6
nandu neerukonda
LQ Newbie
 
Registered: Jun 2011
Location: Pune
Posts: 18

Original Poster
Rep: Reputation: Disabled
less /home/$username/.bash_history


does this work even if the user dont have a home directory?
 
Old 10-29-2011, 07:37 AM   #7
fukawi1
Member
 
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 190Reputation: 190
No.
I wouldnt imagine the users without home directories histories are being saved...
 
Old 10-29-2011, 07:38 AM   #8
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
Quote:
Originally Posted by nandu neerukonda View Post
less /home/$username/.bash_history


does this work even if the user dont have a home directory?
Nope. But a user must have a HOME, maybe not under the /home directory/partition but any user which is able to login through ssh/putty has a HOME somewhere and it is specified in /etc/passwd. Anyway, since you're root, you can switch to the user login without password and check the history using the history built-in, as shown by onebuck above.

If you want to keep trace of the users activity, you may want to consider an audit software, e.g. psacct.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
user history elainelaw Linux - Software 1 07-29-2010 06:02 AM
How to Look at history file in unix shell for a user ayongying Linux - General 5 05-29-2010 03:37 AM
New User Mercedes300 -- A history. - LONG mercedes300 LinuxQuestions.org Member Intro 1 10-10-2009 01:14 PM
tcsh: can you save the history from multiple shells to one history file? BrianK General 2 04-23-2009 06:19 AM
tracking history cmd by other user jenson Linux - Server 2 12-01-2007 09:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration