How to change file "last status change time"?

How to change file "last status change time"?

Post by Jyh-Shyang Wa » Fri, 20 Oct 1995 04:00:00



Hi,
        Who can tell me how to change one file's st_ctime("last
status change time")?
        I can change access & modify time by utime or utimes,
but I had not find command which can change st_ctime...

thanx for any help...

--

Institute of Electronics, National Chiao-Tung University, Taiwan, R.O.C.

 
 
 

How to change file "last status change time"?

Post by Ruurd Beerst » Sat, 21 Oct 1995 04:00:00


: Hi,
:       Who can tell me how to change one file's st_ctime("last
: status change time")?
:       I can change access & modify time by utime or utimes,
: but I had not find command which can change st_ctime...

: thanx for any help...

Can't be done. The act of setting the atime or mtime modifies ctime.
There is no system call to change ctime. The alledged purpose is to
keep track of modifications to a file, even when the modificator
takes the trouble to undo as much as possible (security etc..).

It makes *big* trouble for backup programs that want to make backups
*without any* modification to the filesystem. When the program reads
the file, ATIME is updated. When it resets ATIME, CTIME gets updated.
The only way for them is to go through the /dev/dsk interface (raw
disk) and interpret the filesystem structures themselves. In the light
of the large number of different types of filesystems that is a major
pain.

Also, from a security point of view, if the system is hacked and
the hacker wants to reset file-modifications times he could always
use the same /dev/dsk interface to cover his tracks. I think it would
make sense to have a super-user restricted call to reset ctime to any
desired value.

BTW - if anybody knows a solution to this problem I would be *really*
interested!

        Ruurd.
--
========================================================================
Ruurd Beerstra, CMG-IT, Netherlands. | #include <stddisclaimer.h>