LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to Redirect Local User Historys ? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-redirect-local-user-historys-4175439070/)

bala.linuxtech 11-28-2012 12:33 AM

How to Redirect Local User Historys ?
 
Hi all

I am Using RHEL 5.4 Box., I would like to redirect my Local users histories ( /home/.bash_history) to /root/users_history file..

Is it possible to redirect ??

Guyz , Please suggest me your ideas!!

Regards
Bala

chrism01 11-28-2012 01:31 AM

The problem is root's home dir is
Code:

dr-xr-x---.  17 root root  4096 Nov 28 17:27 root
so even adding a world writable file eg
Code:

-rw-r--rw-. 1 root root          0 Nov 28 17:27 t.t
you still get
Code:

echo 'test' >/root/t.t
bash: /root/t.t: Permission denied

allowing write to root's home dir is a really bad idea.

Why would you want this anyway?

bala.linuxtech 11-28-2012 02:01 AM

Quote:

Originally Posted by chrism01 (Post 4838544)
The problem is root's home dir is
Code:

dr-xr-x---.  17 root root  4096 Nov 28 17:27 root
so even adding a world writable file eg
Code:

-rw-r--rw-. 1 root root          0 Nov 28 17:27 t.t
you still get
Code:

echo 'test' >/root/t.t
bash: /root/t.t: Permission denied

allowing write to root's home dir is a really bad idea.

Why would you want this anyway?


Chris

Good., I know very well that its very bad to redirect to /root/ ,
Here that Destination(/root/user_history) file is doesn't matter .. i would like to know is it possible to redirect, if its possible then how ?

Chris ., pls suggest me is it possible to redirect that histories to some where ?


Regards
Bala

chrism01 11-28-2012 02:47 AM

You could probably symlink them to /tmp, but I'm not sure you wouldn't have issues if you try to put them all in the same file.
Again, why do this?

bala.linuxtech 11-28-2012 11:09 PM

Quote:

Originally Posted by chrism01 (Post 4838582)
You could probably symlink them to /tmp, but I'm not sure you wouldn't have issues if you try to put them all in the same file.
Again, why do this?

chris

Thanks ., Here I have a order to save all Local user history's, that is why i am going on this ... here i am going to redirect all local users history's to each file under /tmp ., is symlink method will helpful for this ? is there any other way to redirect ?

Once again thanks Chris !

Regards
Bala

chrism01 11-29-2012 12:22 AM

Well it'd be easier to just create a cron job to back them up every day.
Note that the user has to be able to write to the history file, which also means that he can empty them.

This is not a secure way of tracking the user.
If you are after a secure method, you could have a look at rootsh http://sourceforge.net/projects/rootsh/

bala.linuxtech 11-29-2012 12:26 AM

Quote:

Originally Posted by chrism01 (Post 4839260)
Well it'd be easier to just create a cron job to back them up every day.
Note that the user has to be able to write to the history file, which also means that he can empty them.
This is not a secure way of tracking the user.


Yes chris., that is happening here .. some users deleting their history's very often .. what should i do ? how to redirect the user history's in effective manner ?

Regards
bala.linuxtech

chrism01 11-29-2012 12:42 AM

As I said, look at rootsh

bala.linuxtech 11-29-2012 01:08 AM

Quote:

Originally Posted by chrism01 (Post 4839270)
As I said, look at rootsh

Yes sure ..

Thanks Chris


All times are GMT -5. The time now is 10:25 PM.