LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 03-31-2017, 06:00 PM   #1
jimb.smith
LQ Newbie
 
Registered: Mar 2017
Posts: 4

Rep: Reputation: Disabled
Is it possible to combine every users command history and recall it?


From a security perspective I know this is a really bad idea but I'm trying to make it so that every user on my system can recall the most recent and available command history in the entire system from every user.

For example, if I'm currently logged in as Steve and run a few commands, then switch over into Bryan, I want Bryan to be able to recall Steve's and anyone before hims command history.

So is there a way to combine or append every users .bash_history together to be universally shared?
 
Old 03-31-2017, 07:33 PM   #2
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
maybe try to set up some type of linked file in a central localization that is linked to every user in the system.

not tested example:

first delete the original .bash_history file, then create a new file in that central location.
Code:
/opt/users_bash_history

ln -s /opt/users_bash_history /home/userName/.bash_history
theoretically then every users commands will be sent to that file in /opt instead. as they all are soft linked to their own pseudo bash_history file then who ever uses a command will be written to the /opt/file instead with permissions to be read write for everyone.

the file can be anywhere as long as the right permissions are set to the file.

Last edited by BW-userx; 03-31-2017 at 07:53 PM.
 
Old 03-31-2017, 07:52 PM   #3
jimb.smith
LQ Newbie
 
Registered: Mar 2017
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thanks, I'll get back to you if it works or not.
 
Old 03-31-2017, 07:57 PM   #4
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by jimb.smith View Post
Thanks, I'll get back to you if it works or not.
yes please do. I am very curious to see if that works.
 
Old 03-31-2017, 09:34 PM   #5
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Note that bash does not write to .bash_history during the session. The .bash_history file is updated when the session closes. Having multiple users' shells writing end-of-session blocks to the same history file (and each time truncating it to HISTFILESIZE lines) will likely just make a mess.

Do you really want users "ctrl-r"-ing back through each other's commands?
 
Old 03-31-2017, 09:45 PM   #6
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Note the .bash_history has 0600 permissions, bash may check the permissions before writing. Just thinking out loud.
 
Old 04-03-2017, 12:05 AM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Let's just hope there are no passwords on your cmd lines EVER....
 
  


Reply

Tags
centos, rhel



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
/bin/false users command history SantoshSonavale Linux - Server 1 08-12-2015 05:17 AM
Why does BASH history command have no history when run in script ? lump_of_lard Programming 4 01-30-2015 09:45 AM
How to restrict all users to stop clearing command history on CentOS jaipsharma Linux - Security 8 09-27-2012 06:22 PM
Need to log users command history FatSteve Linux - Security 2 07-22-2004 06:25 PM
Enabling arrow keys for history recall subu_s General 1 06-18-2004 07:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 05:26 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