[SOLVED] Can we change Entries in the inode table of a file (Linux)
Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Now the above is the inode stat of the index.php's file.
I was wondering if I can change the entries in this inode table's entries.
For example I want to change the "Modify" entry ? I want it to reflect to day 2009-05-19 for example.
for example I want to change the "Modify:" line in this table
and I want to set the date in the "Modify:" line of this table to reflect 2001-04-19
instead of it's current value 2011-05-19 ..
is it possible ?
Yes -- it is possible. The easiest way is to use the touch command. Why do you not want to do it that way? Do you want to write a program to do what the touch command does? Do you want to find the location of the data on HDD and change it directly?
I would like to know whether I could know this file's location directly on HDD?
Can I open that file from there and change it instead ?
Thanks
It is technically possible but difficult to locate and modify an inode on HDD. The specifics depend on the file system type.
Why do you want to do so when the touch command can do exactly what you want and a lot more easily?
Please be aware of LQ's rule "Posts containing information about cracking, piracy, warez, fraud or any topic that could be damaging to either LinuxQuestions.org or any third party will be immediately removed". You are unlikely to get much help here unless you convince us you are not breaking that rule.
I was just wondering, if all the entries in the inode table of a file
are editable by the owner of that file ? Or there are any entries that
can only be modified by the kernel only.
The straighforward way to alter file system data is by system calls to the kernel (which may be generated by commands such as rm, ln, touch etc., via a shell's redirection operators such as >, via a GUI or from a program using system call libraries such as compiled C) which then alters the file system data via file system drivers. In this case the file and directory permissions control which users can change the data.
Alternatively you can write directly to the HDD via its block device files such as /dev/sda, /dev/sda2 etc. using something like the dd command. This requires a knowledge of the file system structure to determine the position of the data (including inode) to be changed. A mistake can corrupt the file system. If it is done while the file system is mounted the usual issues of multi-write access causing data skew arise. The HDD's block device files are writeable only by root so only root can do this.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.