LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-04-2011, 08:10 AM   #1
hhh123
Member
 
Registered: Jul 2009
Location: /
Distribution: centos
Posts: 47

Rep: Reputation: 1
Server History


HI All,

have a server with me which is managed by me and more 5 ppl, my main problem is that , i can't find who is doing what using history command. And this thing happen when all ppl login by using same credential and at the same time.


NOTE :- All users are using same username and password.
 
Old 11-04-2011, 08:58 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
First, give everyone their own username and password, multiple people using the same login is bad practise.
Second, lock them down to bash shell.
Third, add this to your /etc/profile to log every command used to /var/log/messages
Code:
function log2syslog
{
   declare command
   command=$(fc -ln -0)
       if [ "${command}" != "" ]
       then
   logger -p local1.notice -t bash -i - $USER:"${command}"
       fi
}
trap log2syslog DEBUG
Good luck.
 
1 members found this post helpful.
Old 11-04-2011, 09:04 AM   #3
goossen
Member
 
Registered: May 2006
Location: Bayern, Germany
Distribution: Many
Posts: 224

Rep: Reputation: 41
Having several people using the same user/password at same time is not a good idea.

That said, there are some commands may help you.

I'm assuming you are using bash, which by default, updates its history only on exit.
To solve this you can set the shell option histappend, causing all new history lines to be appended, and avoiding that multiple logins overwrite each other's history.
Code:
shopt -s histappend
To ensure that history is written after each command. You can may add "history -a" to the PROMPT_COMMAND variable. This variable contains a command to be executed before any new prompt is shown, and is therefore run after every interactive command is executed.
Code:
PROMPT_COMMAND="history -a"
export PROMPT_COMMAND
Additionally, you can increase the history size (default is 500)
Code:
unset HISTFILESIZE
HISTSIZE=10000
export HISTSIZE
You can add these commands to your ~/.bashrc
 
Old 11-04-2011, 12:11 PM   #4
hhh123
Member
 
Registered: Jul 2009
Location: /
Distribution: centos
Posts: 47

Original Poster
Rep: Reputation: 1
First of all thank you so much for reply and great useful guidelines "TenTenths goossen". I know its not good practice to use one username and password with many ppl..but due to some business requirement i need to share that root's password.
 
  


Reply



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
clients browsing history in server dinakumar12 Linux - Server 6 05-19-2010 12:29 PM
history clearance for a particular history number in linux sangupari Linux - Software 3 03-03-2010 03:08 AM
tcsh: can you save the history from multiple shells to one history file? BrianK General 2 04-23-2009 05:19 AM
Download history and copy history? inverted.gravity Linux - Newbie 1 02-21-2006 12:31 PM
is there an SSH advanced Server history? linuxadickt Linux - Software 1 09-08-2005 04:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:30 PM.

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
Open Source Consulting | Domain Registration