Capture of all commands issued by the user “root”

Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Capture of all commands issued by the user “root”
# 1  
Old 03-18-2007
Capture of all commands issued by the user “root”

I have to write a script (not C based) that allows to capture of all commands issued by the user “root”.

First, I tried to monitor the .bash_history but the commands are written in chunk after the .bash_history is closed.

How can I capture the commands in Real-Time without waiting root to close his shell ?
# 2  
Old 03-18-2007
It helps to mention what operating system you are talking about, also why does it need to be a shell script?
# 3  
Old 03-19-2007
not a GUI

It has to be compliant with RHEL3, RHEL4, SLES9, AIX 5.2, AIX 5.3

the module has to be written as a script because it has to be integrated in a proprietary agent that runs only scripts.

All the processing has to run in the background (Not a GUI).
# 4  
Old 03-19-2007
man script
# 5  
Old 03-19-2007
Add the following line to .profile (In case you are using Ksh)

script -a ~/.termlog`date +%m%d%y`

This enable to capture all the terminal activities to a file.

Please let me know if this works.

Nagarajan Ganesan
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Running commands in remote node as root user

Platform :Oracle Linux 6.4 We are trying to automate the SAN level cloning from production RAC DB cluster to test. From a shell script, I would like to run the below command Step1,2 and 3 from Node1 in a sequential order as root user . How can I do this ? passwordless for root user is not... (2 Replies)
Discussion started by: kraljic
2 Replies

2. AIX

List of AIX commands that can be run by ROOT user ONLY

Hello, I am testing sudo and I want to test it. Can anyone please let me know few commands (of course other than shutdown, reboot etc. as I can't reboot the box) on AIX that can be run by ROOT only. Thanks ---------- Post updated at 07:43 PM ---------- Previous update was at 07:38 PM... (5 Replies)
Discussion started by: prvnrk
5 Replies

3. Shell Programming and Scripting

Script to run commands as root user

Hello I have a script which is working fine so far to generate HTML file. Now i am wondering how do i include a syntax where it can change itself to root user and execute a specific commands as root user. Please help, Thanks in advance. -Siddhesh (2 Replies)
Discussion started by: Siddheshk
2 Replies

4. UNIX for Dummies Questions & Answers

Sudo to delegate permission from non-root user to another non-root user

I've been through many threads before i decide to create a separate thread. I can't really find the solution to my (simple) problem. Here's what I'm trying to achieve: As "canar" user I want to run a command, let's say "/opt/ocaml/bin/ocaml" as "duck" user. The only to achieve this is to... (1 Reply)
Discussion started by: canar
1 Replies

5. Shell Programming and Scripting

How to restrict root user from running some commands

is it possible that we can restrict the root user if he runs some commands?? e.g i want if root runs command 'rm etc/passwd', he shoudn't be able to run command and throws error :confused: (3 Replies)
Discussion started by: sheelsadan
3 Replies

6. UNIX for Advanced & Expert Users

audit user commands of different users under root account

Hi, I would like to know if there is anyway that I can pinpoint the user before/after he connects to the root? Also, I'm trying to find out what are the commands he inputs under root access. (6 Replies)
Discussion started by: pointgetter0
6 Replies

7. UNIX for Dummies Questions & Answers

How to allow access to some commands having root privleges to be run bu non root user

hi i am new to unix and i have abig task. i have to \run particular commands having root privileges from a non root user. i know sudo is one of the way but i need sum other approach kindly help Thanks (5 Replies)
Discussion started by: suryashikha
5 Replies

8. Shell Programming and Scripting

How a normal user run a script including root privileaged commands

Dear all Ihave written a script in Hpux9.0, the ecript is working fine if I run it from root command prompt But when I am running it thru /etc/profile or /user/.profile and login as a normal user, the owner of the process running the script is the normal user & hence cant run a root privileaged... (7 Replies)
Discussion started by: initin
7 Replies

9. HP-UX

user commands without root access

Hi I have been asked to find out how to 1) create users 2) reset passwords 3) kill processes that may require root privileges without having root password, sudo rights or rights to passwd command Any ideas? Thanks in advance (1 Reply)
Discussion started by: emealogistics
1 Replies

10. Shell Programming and Scripting

Capture user imput commands

Hi all, I have a problem which needs to be solved soon because it affects auditing capabilities. There is an application id that has to be used by other users for the purpose of production support. The application user id uses C shell. We allow users to switch to the application user id based... (1 Reply)
Discussion started by: s_saran
1 Replies
Login or Register to Ask a Question

Featured Tech Videos