HOw I can Know who Access my file!!


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers HOw I can Know who Access my file!!
# 1  
Old 06-10-2002
HOw I can Know who Access my file!!

Hi there

I just want to know what is the best way to know who access my file and when?

I want also to know if it's possiple to hide or restrict access to file or directory even from the root ' I THINK MUCH BETTER TO CHANGE THE NAME THEN Smilie "!!!


thanks in advance

Abdulkarim
# 2  
Old 06-10-2002
Some versions of unix have features that would allow root to know who accesed a file and when. But ordinary users cannot access them. Also the root user can access any file. If, for some odd reason (like nfs), root can't access a file, root can simply become another user.

The only way to protect your files from your system administrator is to get your own computer.

Encrypting your files may be a partial answer, but they will need to be in plaintext as you use them and root can view them while they are.
# 3  
Old 06-19-2002
cheesy answer here

Its kind of cheesy, but you can use .filename or put spaces in the filename or leading spaces to make hard on those who don't know how to handle that. Like a leading space in a filename that will stop most people.

touch " filename"
touch ". filename"

ls filename won't work. You must do ls " filename" or ls ". filename" to ls the file.

Same with vi. If they try to vi . filename, vi will try to open the directory as a file and a file called "filename". 2 files!



ONE CAVEAT HERE...

However, in my environment. I as root have cron jobs that search for and report an files with weird filenames.

So you can't stop root from finding or accessing them. Maybe these tactics will stop some from looking at your file. Although, it kind of like locking your car doors with the window rolled down!

Try it and report back.

Smilie
# 4  
Old 06-19-2002
You could also write a shell script using lsof and grep out by the individual filename and append the grep output if found to another textfile. Although, I have to admit that it is not terribly effective.

Code:
#!/bin/sh

while true
  do
    sleep 1
    lsof | grep -i "MySpecialFile" >> paranoia.txt
done

Resulted in this output:

Code:
vi        3703    auswipe    3rW VREG 116,131078        159 1411444 /usr/home/auswipe/paranoid/MySpecialFile
vi        3703    auswipe    3rW VREG 116,131078        159 1411444 /usr/home/auswipe/paranoid/MySpecialFile
vi        3703    auswipe    3rW VREG 116,131078        159 1411444 /usr/home/auswipe/paranoid/MySpecialFile
vi        3703    auswipe    3rW VREG 116,131078        159 1411444 /usr/home/auswipe/paranoid/MySpecialFile
vi        3703    auswipe    3rW VREG 116,131078        159 1411444 /usr/home/auswipe/paranoid/MySpecialFile
vi        3703    auswipe    3rW VREG 116,131078        159 1411444 /usr/home/auswipe/paranoid/MySpecialFile
vi        3703    auswipe    3rW VREG 116,131078        159 1411444 /usr/home/auswipe/paranoid/MySpecialFile
vi        3703    auswipe    3rW VREG 116,131078        159 1411444 /usr/home/auswipe/paranoid/MySpecialFile
vi        3703    auswipe    3rW VREG 116,131078        159 1411444 /usr/home/auswipe/paranoid/MySpecialFile
vi        3703    auswipe    3rW VREG 116,131078        159 1411444 /usr/home/auswipe/paranoid/MySpecialFile
vi        3703    auswipe    3rW VREG 116,131078        159 1411444 /usr/home/auswipe/paranoid/MySpecialFile
vi        3703    auswipe    3rW VREG 116,131078        159 1411444 /usr/home/auswipe/paranoid/MySpecialFile
vi        3703    auswipe    3rW VREG 116,131078        159 1411444 /usr/home/auswipe/paranoid/MySpecialFile
vi        3703    auswipe    3rW VREG 116,131078        159 1411444 /usr/home/auswipe/paranoid/MySpecialFile
vi        3703    auswipe    3rW VREG 116,131078        159 1411444 /usr/home/auswipe/paranoid/MySpecialFile
vi        3703    auswipe    3rW VREG 116,131078        159 1411444 /usr/home/auswipe/paranoid/MySpecialFile

The cheezy little script wasn't able to pickup that elvis had opened the file (copied to temp file for manipulation) and because the file was so small, lsof with a one second interval wasn't able to catch the file being copied.

There is bound to be a better solution for this type problem. I would suggest Google for searching.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to access multiple file and operate on single file

We have three files as mentioned below: 1. main_file.txt: This is the file in which all operations will be done. Which means this file will be signed by using the below two files 2. signature_file.txt: This is a status file and contains two signatures. 3. command.txt:file contains two commands... (2 Replies)
Discussion started by: chetanojha
2 Replies

2. Proxy Server

How to use Squid on Linux to control certain IP to access Web Server and certain IP cannot access?

Dear all experts here, :) I would like to install a proxy server on Linux server to perform solely to control the access of Web server. In this case, some of my vendor asked me to try Squid and I have installed it onto my Linux server. I would like know how can I set the configuration to... (1 Reply)
Discussion started by: kwliew999
1 Replies

3. Solaris

samba read write access to owner and no access to other users

Hi All, I want to configure samba share permission so that only directory creator/owner has a read and write permission and other users should not have any read/write access to that folder.Will that be possible and how can this be achieved within samba configuration. Regards, Sahil (1 Reply)
Discussion started by: sahil_shine
1 Replies

4. UNIX for Dummies Questions & Answers

Access to a file

Hey friends, If a file has permissions 000, then who can access the file? (1 Reply)
Discussion started by: paras.oriental
1 Replies

5. IP Networking

Does my provider limit my internet access or somesites access?

Hi Good Day, i would like to ask for further info about my problems experiencing this evening. Im a PPP0 connection in the internet using 3G located in asia pacific region.i had this problem this evening in my INTERNET connections that there are some sites i can't open example ( Gizmodo.com,... (2 Replies)
Discussion started by: jao_madn
2 Replies

6. UNIX for Dummies Questions & Answers

kernel giving access for multiple users to access files

hi all, i want to know y kernel is giving access for multiple users to access a file when one user may be the owner is executing that file. Because other user can manipulate that file when the other user is executing that file, it will give the unexpected result to owner . plz help me... (1 Reply)
Discussion started by: jimmyuk
1 Replies

7. Programming

how to write Microsoft Access MDB file to a text file, using C ?

I'm in the UNIX environment. I'd like to read a Microsoft Access MDB file, and write the contents of that file into an ASCII text file. I want to write a C program to do this. Does anyone know if there's already source code out there that does this? Please advise. Thanks. (3 Replies)
Discussion started by: serendipity1276
3 Replies

8. Cybersecurity

file permission/acl: 2 users with write access on 1 file...

Hello, i need some help/advice on how to solve a particular problem. these are the users: |name | group | ---------- --------------- |boss | department1 | |assistant | department1 | |employee | department1 | |spy | department2 | this is the... (0 Replies)
Discussion started by: elzalem
0 Replies

9. Programming

[C++] File I/O (Reading from a Random-Access File)

INFO: The program should enter a circle radius and Id for that circle to a file, then it should search for that id and print the radius for that circle. PROBLEM: This program compiles but it's not searching properly. Circle.h #ifndef CIRCLE_H #define CIRCLE_H #include <iostream>... (0 Replies)
Discussion started by: VersEtreOuNe
0 Replies

10. UNIX for Dummies Questions & Answers

Need help to access/mount so to access folder/files on a Remote System using Linux OS

Hi I need to access files from a specific folder of a Linux system from an another Linux System Remotely. I know how to, Export a folder on One SCO System & can access the same by using Import via., NFS in the Sco Unix SVR4 System using the scoadmin utility. Also, I know to use mount -t ... (2 Replies)
Discussion started by: S.Vishwanath
2 Replies
Login or Register to Ask a Question