0

After doing some experimentation of my own, I noticed that the access times on files are not always updated when accessed, either through a text editor -- without modifying the file -- or cat.

Although I don't have the server edition of Ubuntu installed, I imagine this would be pretty useful in a server environment, in cases where a breach is suspected.

In particular, I'd like to know which file I need to modify so that the access times on files get automatically updated no matter how many times they're accessed.

  • A reproducible example, please – muru Oct 30 '17 at 04:05
  • @muru Sure. I'll create a non-existing file with `touch file1.txt`. Then I will attempt to access the file's contents using `cat file1.txt`, which will modify the access time, but then if I type `cat file1.txt` a second time, a few minutes later, the access time won't change. – John_Patrick_Mason Oct 30 '17 at 04:13
  • 3
    Possible duplicate of [Why does not the atime option of mount always update atime of files as expected?](https://askubuntu.com/questions/383401/why-does-not-the-atime-option-of-mount-always-update-atime-of-files-as-expected) – muru Oct 30 '17 at 04:19
  • Looks like `relatime` in action. Maybe mount with `strictatime`. – muru Oct 30 '17 at 04:20
  • I read the answer in the link you provided. Is there anyway I can change a configuration file so that /home or even / is mounted automatically with the strictatime option? – John_Patrick_Mason Oct 30 '17 at 04:25
  • Yes, update the `/etc/fstab` entries of those filesystems to include `strictatime` after the options already present. – muru Oct 30 '17 at 04:26
  • One last question. Is there any danger to remounting the / or /home filesystems with the command you provided? I'm used to remounting USB flash drives, but I feel a little nervous having to remount those filesystems. – John_Patrick_Mason Oct 30 '17 at 04:28
  • With this option remounting would be fine, but if you remount with `noexec` or `nosuid` or something like that, things may break. – muru Oct 30 '17 at 04:30
  • Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/67862/discussion-between-john-patrick-mason-and-muru). – John_Patrick_Mason Oct 30 '17 at 04:42

0 Answers0