- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: How to uniquely identifity a file?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2001 06:44 AM
07-09-2001 06:44 AM
How to uniquely identifity a file?
(The file will be modified frequently, so I cannot use file update time for the purpose.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2001 06:48 AM
07-09-2001 06:48 AM
Re: How to uniquely identifity a file?
File size?
...jcd...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2001 06:52 AM
07-09-2001 06:52 AM
Re: How to uniquely identifity a file?
Let's take your example with a file named 'A' and the file is in the directory /Alpha. If someone moves the file to A.bak, but it is still in the directory /Alpha then the you can use the inode number of the file. You can see the inode number by doing an 'ls -i A' or 'll -i A'. Here is an example:
# touch A
[uran:root] 515 /tmp
# ll -i A
194 -rw-rw-r-- 1 root sys 0 Jul 9 09:51 A
[uran:root] 516 /tmp
# mv A A.bak
[uran:root] 517 /tmp
# touch A
[uran:root] 518 /tmp
# ll -i A*
195 -rw-rw-r-- 1 root sys 0 Jul 9 09:51 A
194 -rw-rw-r-- 1 root sys 0 Jul 9 09:51 A.bak
You will notice that A.bak kept its original inode # of 194 even after it was moved.
If the file is moved to a different directory, and that directory is in a different Logical Volume, then the inode number will change, and I don't know how you could keep track of the file that way.
Does this help?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2001 06:58 AM
07-09-2001 06:58 AM
Re: How to uniquely identifity a file?
Richard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2001 07:01 AM
07-09-2001 07:01 AM
Re: How to uniquely identifity a file?
There are a few indicators of the action that you describe, but none will provide absolute assurance.
1. Every file has a unique 'inode' number within a filesystem (mountpoint). The number can be seen with 'ls -i
2. If a file is modified (permissions changed, deleted and recreated) then 'ls -lc' will indicate an altered timestamp (see "man ls"). HOWEVER, the problem with looking at this timestamp, is that backup utilities like 'fbackup' will reset the lastaccess timestamp and therefore alter the last inode change timestamp too which is what 'ls -lc; reports.
3. Assuming that the file in question has been deleted and recreated, but slightly differently, then the best indictator of change would be a different checksum (see "man cksum") for the file. This assumes, of course, that you recorded the original checksum somewhere for comparison.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2001 07:08 AM
07-09-2001 07:08 AM
Re: How to uniquely identifity a file?
This one is tricky. Patrick's idea of inode number works somewhat but it not foolproof. If someone removed the file and then recreated it there is a very chance that the same inode would be reused. All the date/timestamp fields associated with the file can be manipulated.
The only sure method would be to encode unique data within the file itself. If you have access to the code, you could insert a timestamp or other data in the first few bytes of the file. If not (and the file does not grow with time), you could append data to the file which hopefully you application will ignore.
Perhaps the best method is to ensure that the problem does not occur by restricting permissions on the directory and perhaps setting the sticky bit on the directory so that only the file or directory owner can remove the file.
Food for thought, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2001 07:15 AM
07-09-2001 07:15 AM
Re: How to uniquely identifity a file?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2001 07:16 AM
07-09-2001 07:16 AM
Re: How to uniquely identifity a file?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2001 07:20 AM
07-09-2001 07:20 AM
Re: How to uniquely identifity a file?
Actually that give me an idea . If you really can then do a ls -li and store the inode no. of the file any other file created will be of differnet inode no .This will be good since files have unique id nos.
Manoj Srivastava
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2001 07:44 PM
07-09-2001 07:44 PM
Re: How to uniquely identifity a file?
The inode number will only be unique among files that
currently exist. Much like phone numbers, once
you give up the inode (delete the file) it may eventually
be reused. Also inode numbers are only unique within a
logical file system. Again to compare to phone numbers
an inode would be like the last four digit which are
unique within an exchange, but are used by several
exchanges. The inode won't change if you move the
file within a file system, but likely will if you move it
to another file system.
As noted the dates can be changed (see man touch).
If I wanted to hide the fact I had replaced your file,
I could always truncate and overwrite the existing
file. Same inode, and I can reset the timestamps, or
on some systems access the raw drive and hide
the file change entirely.
Checksums work if the file doesnt change. If the
file changes then checksums won't work. Checksums
are not necessarily unique.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2001 02:33 PM
07-14-2001 02:33 PM
Re: How to uniquely identifity a file?
you will have to go for a solution a'la "tripwire"!
HTH,
Wodisch
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2001 12:52 AM
07-16-2001 12:52 AM
Re: How to uniquely identifity a file?
Next time "A" is created, it will definitely have a different inode - again create a new hard link.
As I say, you're tying up inodes, but you'll be able to tell if "A" has changed.
Robin