Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to change ctime of file?

1,128 views
Skip to first unread message

frankie

unread,
Jul 14, 2006, 5:44:31 AM7/14/06
to
I can use "touch" with options like "-a -m -t" to set any time to
"mtime" and "atime" of a file, but there is no option how to change
ctime :( It always points to the time of chage/modify file. Is it any
way to set any other time?

frankie

Bill Marcum

unread,
Jul 14, 2006, 8:34:59 AM7/14/06
to
On 14 Jul 2006 02:44:31 -0700, frankie
Only by changing the system time, and that is usually not a good idea.


--
He who fears the unknown may one day flee from his own backside.
-- Sinbad

frankie

unread,
Jul 19, 2006, 4:22:21 AM7/19/06
to

Bill Marcum napisal(a):

> Only by changing the system time, and that is usually not a good idea.
>

Is it true? Maybe there are tools for editting inode table?

frankie

Bill Marcum

unread,
Jul 19, 2006, 9:15:30 AM7/19/06
to
On 19 Jul 2006 01:22:21 -0700, frankie
Why would you want to change a file's ctime?


--
Real Programmers don't eat quiche. They eat Twinkies and Szechwan food.

frankie

unread,
Jul 20, 2006, 3:50:07 AM7/20/06
to

Bill Marcum napisal(a):

>
> Why would you want to change a file's ctime?
>

Beacuse I am curious if it possible ;)

frankie

Steven Mocking

unread,
Jul 26, 2006, 11:41:07 AM7/26/06
to

Since ctime is the last time the inode info was changed, you could
change the system date, make a new hardlink, remove it again and change
the date back.

Steven

frankie

unread,
Aug 2, 2006, 2:32:16 PM8/2/06
to

frankie napisal(a):

> Is it true? Maybe there are tools for editting inode table?
>

Finally I've found debugfs tools for ext2/3 filesystems. There is
set_inode_field command so I can edit any inode field. But anybody know
in which format I should give the date/time?

frankie

Bill Marcum

unread,
Aug 3, 2006, 3:14:51 AM8/3/06
to
On 2 Aug 2006 11:32:16 -0700, frankie
Probably in `date +%s` format.


--
Love thy neighbor, tune thy piano.

Michael Paoli

unread,
Aug 13, 2006, 2:11:36 PM8/13/06
to
frankie wrote:
> I can use "touch" with options like "-a -m -t" to set any time to
> "mtime" and "atime" of a file, but there is no option how to change
> ctime :( It always points to the time of chage/modify file. Is it any
> way to set any other time?

Generally speaking, the ctime can't be set arbitrarily. It's
effectively the one relatively high-integrity timestamp on files
(since, as you know, mtime and atime are arbitrarily "user"
settable). Of course one can make certain changes to the file, and
that will update the ctime to the current system time. Of course if
one has superuser (root) access, there are ways to bypass this. E.g.
change the system time (generally not recommended - especially moving
the clock back - most stuff doesn't expect time to go backwards, and
it typically will cause some stuff to fail or behave in unexpected
ways), or unmount the filesystem and edit the data on the filesytem
device (one can set the ctime arbitrarily that way ... and/or
introduce arbitrary corruption or other changes to the filesystem).

See also:
news:1147585091.3...@i39g2000cwa.googlegroups.com
news:1137497064.7...@g43g2000cwa.googlegroups.com

0 new messages