Linux - modify file modify/access/change time [closed]
Asked Answered
E

3

5

I read an article about new steganographic method: "Time is on my side: Steganography in filesystem metadata" http://www.sciencedirect.com/science/article/pii/S1742287616300433. It is very interesting and makes me thinking about one thing.

Is it possible to manipulate file modify/access/change time metedata using C or any other language in Linux OS? I found method which is using touch command, but it creates file with specific tag value. I would like to find way to modify this metadata in existing one.

Emrick answered 16/11, 2016 at 11:13 Comment(3)
look at man touch more carefullyPreclude
@IporSircer I've just found an answer. My question can be closed :)Emrick
Krystian, this site is supposed to be a repository for knowledge in a Q&A format. If you've found an answer to your question, while this question may feel unnecessary to you now, you're still encouraged to write an answer for the benefit of any future readers. Unless you deem the question too trivial to answer or it already has a duplicate on the site, in which case you should flag it thusly.Risser
E
11

Using touch command you can edit time metadata of files. Example:

touch -a -t 201611161200.10 file.txt

It will result in modifing access timestamp, and replace it with date 2016-11-16 12:00:10.000000000 To change 'Modify' date you should use flag -m

Emrick answered 16/11, 2016 at 12:53 Comment(0)
T
6

I came across this thread and I had to share my findings (as mentioned this site is a repository for knowledge):

Testudinal answered 13/2, 2017 at 22:20 Comment(1)
See also lutimes() if you want to correctly handle symlinks.Skillful
S
1
touch -c -m --date="2022-02-19 10:00" /path/to/your/file
Sims answered 21/2, 2022 at 15:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.