Unix Internal Question


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Unix Internal Question
# 1  
Old 04-23-2008
Unix Internal Question

Hi Guys-

Does anyone know how to determine the unix user id that accessed a particular file?

For instance, we have a particular file under /usr/var/sample.exe ; I'm executing "ls -ltu /usr/var/sample.exe" and finds out that it has been accessed recently. How could i find out the user id that accessed it? Or the user id that launched/owned a process that actually accessed the file?

Thanks in advance.

-Marlonus999
# 2  
Old 04-23-2008
There is no historical way to see who ran what executable. Some types of add-on accounting software can track this kind of operation - execute access for a file.
What OS?

If sample.exe produces a known output file, look for a file by that name with find and check file ownership.

Your best shot is to implement some shell code with lsof or fuser that will monitor use of that file in the future. If this is a security problem, lock down access to that file/directory.
# 3  
Old 04-24-2008
Great! I was able to monitor file openings of this file via "fuser -f /usr/var/sample.exe". Actually "fuser -fu" does the trick also, but I wanted to know the exact process accessing the file, so I cooked up a short script below. BTW, the OS is HP 11.11

Code snippet:

- - -
#!/bin/ksh

while [ true ]
do
line=`fuser -f /usr/var/sample.exe 2>/dev/null`
if [[ -n $line ]]
then
echo
prc=`echo $line | sed 's/o//g'`

for i in `echo $prc`
do
ps -efxx |grep $i |grep -v "grep"
done

fi
sleep 1
done

- - -

Thanks Jim M. !
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

UNIX internal Algorithms

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Unix internal algorithms like namei() 2. Relevant commands, code, scripts, algorithms: System... (1 Reply)
Discussion started by: Phaneendra G
1 Replies

2. Shell Programming and Scripting

for loop with internal unix command in statement throwing error

Hi I've gotten a plugin script that won't run. I keeps throwing an error at the following line. for BARCODE_LINE in `cat ${TSP_FILEPATH_BARCODE_TXT} | grep "^barcode"` do #something done The error reads ... (3 Replies)
Discussion started by: jdilts
3 Replies

3. Filesystems, Disks and Memory

internal disk and external disk question

Hello, We are running sun solaris and it is connected to SAN storage. How do I find what are the disks are internal and what are the disks are connected to SAN? (0 Replies)
Discussion started by: mokkan
0 Replies

4. AIX

Internal error

Dear experts, please inform when i am trying to use dbx to debug my code, iam getting following error: internal error: expected member attribute 's', 'p', 'r' or 'b', found... (1 Reply)
Discussion started by: vin_pll
1 Replies

5. UNIX for Advanced & Expert Users

Forwarding internal internet packets to internal webserver using iptables

Hi, I need to redirect internal internet requests to a auth client site siting on the gateway. Currently users that are authenticated to access the internet have there mac address listed in the FORWARD chain. All other users need to be redirected to a internal site for authentication. Can... (1 Reply)
Discussion started by: mshindo
1 Replies

6. Programming

Unix Internal

What is Unix Internals on a Layman's Language.Can I consider Unix Internal expert for a Unix's Position? Thanks (3 Replies)
Discussion started by: Rengi
3 Replies

7. UNIX for Dummies Questions & Answers

Unix History Question: Why are filenames/dirnames case sentsitive in Unix?

I tried looking for the answer online and came up with only a few semi-answers as to why file and directory names are case sensitive in Unix. Right off the bat, I'll say this doesn't bother me. But I run into tons of Windows and OpenVMS admins in my day job who go batty when they have to deal... (3 Replies)
Discussion started by: deckard
3 Replies

8. UNIX for Advanced & Expert Users

internal security

We have about 300 users in the systeme , they mainly use the software called "netterm" to telnet our RH server to access the db in our internal network , I know there are some secure program like ssh , that is more secure for connection , do you think it is good idea to replace the software in our... (2 Replies)
Discussion started by: ust
2 Replies

9. IP Networking

unix to unix serial connection question

hi there i'm a new bie just got few simple questions to ask. I got expert in windows configuration but totally new to unix environment . I want to make sure a com port (com1) is working, so I connect a 9-pin cable (CB9) for both PC using Unix environment (unix to unix). The question are (1)... (1 Reply)
Discussion started by: typsam
1 Replies

10. UNIX for Dummies Questions & Answers

how internal modem on pc

Would anyone know how to mount an internal modem on Solaris on PC? (7 Replies)
Discussion started by: softarch
7 Replies
Login or Register to Ask a Question