Finding whoami


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Finding whoami
# 1  
Old 05-13-2009
Finding whoami

Hello
I have a question about shell programming
So I recently found out that someone is secretly accessing my files due to my mistake. Of course, now, I changed all the permission so people cannot access my file(s) anymore.
However, I am a little bit mad about the fact and I'd like to find that person
So I was thinking about making simple shell script that does
whoami command and record the output to a file in my folder
So whenever user cd my folder, say "test" folder, then the shell script runs automatically and do "whoami", record the result into a file and save it in my "test" folder
I am wondering if this is possible to do? If so, then could you tell me how?
Also is there other ways I can find the user (who is accessing my file) better way?

By the way, I am using school server so I don't have permission to install or use administrator folders.

Thanks
# 2  
Old 05-13-2009
It is possible to redefine bash/ksh built-ins, eg
Code:
function cd {
    echo $1
    builtin cd "$1"
}

but for this to work like you want this function would have to be sourced by everyone. So you'd either have to put it in everyones ~/.bashrc or ~/.profile, or in one of the global include files.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Capture whoami log on a specific command

// AIX 6.1 TL8 Please advise on how to capture whoami log or the user and time info into a log file (i.e. /tmp/cmdcapture.log) whenever users are executing a certain command(s) so that I can keep the single log history (for all users) of who did what. The command(s) I need to monitor are a... (3 Replies)
Discussion started by: Daniel Gate
3 Replies

2. UNIX for Dummies Questions & Answers

Whoami error

when I type whoami i get an error saying ksh not found.. how do I exit from ksh script and make it work .. (2 Replies)
Discussion started by: lakers646
2 Replies

3. Shell Programming and Scripting

finding first >

I want to erase some php code between a <? and a ?> in HTML containing a keyword, the problem is it finds the last > and wipes out everything before it how do i specify for it to stop searching after the first >? perl -i -p0e 's/<\?php.*keyword.*\?>//s' there's many lines of php code... (2 Replies)
Discussion started by: vanessafan99
2 Replies

4. Shell Programming and Scripting

Finding my public IP

Hi I do use this line to find my public IP. Is there other way I can do this? Maybe create the script some shorter? wget -q -O - http://minip.no | grep "<b>" | head -n1 | cut -d'<' -f3 | cut -d'>' -f2 Thanks (1 Reply)
Discussion started by: Jotne
1 Replies

5. OS X (Apple)

sudo chown -R `whoami` /usr/local

I was following a tutorial on installing Homebrew and I changed the ownership of /usr/local/ to me. Now McAfee Security won't start This is the exact line I typed: sudo chown -R `whoami` /usr/local Then I tried to fix it with: sudo chown -R root /usr/local I still can't start mcafee. It say... (7 Replies)
Discussion started by: chancho
7 Replies

6. Shell Programming and Scripting

whoami export

how can I use whoami on a script for ordinary user? it always says command not found. pls help #!/bin/ksh W='whoami' DATE=`date "+%Y-%m-%d %H:%M:%S"` echo " $DATE- by $W" result 2011-03-29 09:46:16 - by you wil noticed the by is blank...pls help..but in root, it works (1 Reply)
Discussion started by: lhareigh890
1 Replies

7. UNIX for Dummies Questions & Answers

The "Whoami" command

Ladies, Gents, I am fairly new to this game but I am having trouble making the above command work. If I login as root and go to terminal session "whoami" works. If I login as admin open a terminal session and "su root" the "whoami" command comes up with " Not recognised". Any ideas? ... (1 Reply)
Discussion started by: John Dobson
1 Replies

8. Shell Programming and Scripting

finding duplicate files by size and finding pattern matching and its count

Hi, I have a challenging task,in which i have to find the duplicate files by its name and size,then i need to take anyone of the file.Then i need to open the file and find for more than one pattern and count of that pattern. Note:These are the samples of two files,but i can have more... (2 Replies)
Discussion started by: jerome Sukumar
2 Replies

9. Shell Programming and Scripting

Finding max value

My code below is supposed to find which company had the most business and then print the appropriate fields from another file which are the companies ID number and name. I can loop through awk and display all the total amount of business for each company but I need help in only printing out the... (1 Reply)
Discussion started by: Enigma23
1 Replies

10. UNIX for Dummies Questions & Answers

Finding how done IT

HellOooO, How I can find how delete a drictory in the system.If there's 2 root one of them outside the country but we have WAN so he can access the network from outside >>>> we are using same account so how I can know who done it I want to proof that. Regards (5 Replies)
Discussion started by: geoquest
5 Replies
Login or Register to Ask a Question