LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-01-2010, 09:34 PM   #1
booyeeka
LQ Newbie
 
Registered: Apr 2010
Posts: 12

Rep: Reputation: 0
Is normal for /etc/shadow to change it's timestamp?


I noticed that file /etc/shadow changed it's timestamp.

Why it is changed? Is it "normal"?


Thank you in advance!
 
Old 08-01-2010, 10:13 PM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
You need to be more clear here. *nix files don't have a single timestamp, they have three. These are named mtime, ctime, and atime.


mtime is the time of last modification. This means the last time the contents of the file were changed. Note that there is no "creation" time in *nix, the mtime is the closest you have (it's helps to understand this if you think of a modification as erasing the old file and creating a new one).

ctime is the time of last change, that is, the last time the inode metadata was modified. This happens when the file is modified of course, but also at other times, such as when the permissions or ownership are changed, or the file is moved.

atime is the time of last access, the last time the file was read. However one of the odd quirks of the posix standard is that it defines any access of the file inode at all as reading. This includes simply running ls on the directory, so the atime changes quite often by default.


Because the last quirk can be annoying, and in the case of flash drives even leads to shorter hardware life due to excessive write calls, there are some mount options that you can use to control when atime is updated. You can use noatime to disable updating completely, or relatime, which makes it so that atime only updates if ctime or mtime have also changed. I personally recommend using relatime for most of your drives, particularly flash-based ones.

There are a few more atime based options available. Check out the mount man page.
 
Old 08-01-2010, 11:47 PM   #3
booyeeka
LQ Newbie
 
Registered: Apr 2010
Posts: 12

Original Poster
Rep: Reputation: 0
when i run command:

Code:
[root@myserver ~]# ls -l /etc/shadow*
-r--------   1 root     root         1721 Aug  2 02:52 /etc/shadow
-r--------   1 root     root         1722 Aug  2 02:51 /etc/shadow-
[root@myserver ~]#
will i always get this result, in a case that no user has changed his password?
 
Old 08-02-2010, 12:53 PM   #4
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
Well, the time listed by ls -l is the mtime, so it should only change when the file is modified.

What I don't know is whether there are any system functions other than a password/user change that can modify the file. I don't personally know enough about the shadow file to say.
 
  


Reply



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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how can I change the timestamp of a symlink wastingtime Linux - Software 1 02-10-2010 02:18 PM
change timestamp for syslog biiiep Ubuntu 1 03-31-2007 08:38 AM
Change access.log timestamp,squid proxy gordonb Linux - Software 1 04-20-2006 12:28 AM
Shadow 'last change' field s0n|k Linux - Newbie 1 02-25-2006 11:45 AM
how passwd(1) for normal user changes /etc/shadow? sknowonweb Linux - Newbie 1 12-22-2005 12:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration