Are you stuck with fstab can’t open file for writing error? We can help you fix it.
Read only permission for fstab is set for normal users.
At Bobcares, we often get requests regarding fstab as a part of our Server Management Services.
Today let’s discuss how our Support Engineers resolve fstab can’t open file for writing error for our customers.
Causes for fstab can’t open file for writing
The configuration file /etc/fstab contains the necessary information to automate the process of mounting partitions.
If we add a new hard disk or to partition the existing one. We need to modify the fstab file. By default, to read-only is provided for ordinary users as a security measure.
Thus, if fstab does not have the required permission or if an immutable attribute is set this error occurs.
Let’s discuss how our Support Engineers fix the error when trying to make changes in fstab file.
How we fix fstab can’t open file for writing
Recently one of our customers contacted us with the same error. Let’s discuss how our Support Engineers resolved the error for our customers.
No write permission for fstab
One of the common reason for the error is that the fstab is a read-only file. In this case we need to we check the permission of the file using the command.
ls -al /etc/fstab
Thus, we give write permission for the file using the command.
chmod 644 /etc/fstab
On executing the command we will be able to edit the file without any error.
Immutable permission set for fstab
Recently one of the customer contacted us saying we are unable to edit the fstab file. On analyzing the file, write permission was available for the file.
We found that the immutable attribute was set for the file. We check the immutable permission of the file using the command.
lsattr /etc/fstab
The immutable attribute displays as
Thus, we remove the immutable attribute of the file using the command,
chattr -i /etc/fstab
After removing the attribute we edit the file. Once we have edited the file we save the file.
Then we add the immutable attribute back using the command,
chattr +i /etc/fstab
fstab can’t open file for writing.
Thus, we edit the file without any errors..
Root access required to edit
One of the simplest reason for this error to occur is because the root permission is required to edit the fstab. When editing the file we log in as root user and edit the file.
Thus, it resolved the error and we can edit the fstab file.
[Need any assistance in fixing fstab errors? – We’ll help you]
Conclusion
In short, we have discussed fstab. Also, we have discussed how our Support Engineers fix fstab can’t open file for writing error for our customers.
0 Comments