I created a hard link for the shadow file. For removing the passwd of the user I opened the shadow file in vi editor and removed the encrypted passwd and then saved. The inode value of the shadow file was changed. Then I updated the passwd of the user and again the inode value of the shadow file changed. Why the inode of the shadow file changes when it is edited/updated?
Share
VI saves the data in a new file, and then either unlinks or renames the old diretory entry. The hard link is linked to the old one.
This is one of two ways for ensuring data consistency for the case saving fails.
The other way would be to copy the old file and then overwrite it. The old copy would then have a diffferent inum, and the newly saved file would have the same as before.