Unix Technical Forum

How to change ctime of file?

This is a discussion on How to change ctime of file? within the Debian Linux support forums, part of the Debian Linux category; --> I can use "touch" with options like "-a -m -t" to set any time to "mtime" and "atime" of ...


Go Back   Unix Technical Forum > Unix Operating Systems > Debian Linux > Debian Linux support

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-19-2008, 07:52 AM
frankie
 
Posts: n/a
Default How to change ctime of file?

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-19-2008, 07:52 AM
Bill Marcum
 
Posts: n/a
Default Re: How to change ctime of file?

On 14 Jul 2006 02:44:31 -0700, frankie
<franek4always@wp.pl> 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?
>

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-19-2008, 07:53 AM
frankie
 
Posts: n/a
Default Re: How to change ctime of file?


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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-19-2008, 07:53 AM
Bill Marcum
 
Posts: n/a
Default Re: How to change ctime of file?

On 19 Jul 2006 01:22:21 -0700, frankie
<franek4always@wp.pl> wrote:
>
> 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?
>

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


--
Real Programmers don't eat quiche. They eat Twinkies and Szechwan food.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-19-2008, 07:53 AM
frankie
 
Posts: n/a
Default Re: How to change ctime of file?


Bill Marcum napisal(a):
>
> Why would you want to change a file's ctime?
>


Beacuse I am curious if it possible

frankie

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 01-19-2008, 07:53 AM
Steven Mocking
 
Posts: n/a
Default Re: How to change ctime of file?

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?


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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 01-19-2008, 07:54 AM
frankie
 
Posts: n/a
Default Re: How to change ctime of file?


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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 01-19-2008, 07:54 AM
Bill Marcum
 
Posts: n/a
Default Re: How to change ctime of file?

On 2 Aug 2006 11:32:16 -0700, frankie
<franek4always@wp.pl> wrote:
>
> 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?
>

Probably in `date +%s` format.


--
Love thy neighbor, tune thy piano.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 01-19-2008, 07:55 AM
Michael Paoli
 
Posts: n/a
Default Re: How to change ctime of file?

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?


frankie wrote:
> 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?


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.352911.276580@i39g2000cwa.googlegr oups.com
news:1137497064.725217.172010@g43g2000cwa.googlegr oups.com

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:51 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com