Root/non-user not able to delete files, Read only permission issue
Linux - NewbieThis 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
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.
Root/non-user not able to delete files, Read only permission issue
Hi!! one strange problem occurred with my RHEL 5 box.
i'm having logs folder with ownership of non-root user. Created some files with root user under logs folder.
here is the scene:
Code:
-rw-r----- 1 root root 1048227 Feb 28 12:34 SystemOut_13.02.28_12.34.10.log
-rw-r----- 1 root root 415920 Mar 14 16:41 SystemOut.log
-rw-r----- 1 root root 20902127 Mar 2 22:15 trace_13.03.02_22.25.53.log
-rw-r----- 1 root root 2579956 Mar 14 16:41 trace.log
I'm not able to delete the files with both users.
Below error is coming up
Quote:
rm: cannot remove `SystemOut_13.02.28_12.34.10.log': Read-only file system
I tried lsattr and chattr, below the output of both:
I tried to delete those files using root only. Same read only file system error.
nothing is working. neither root nor non-root is able to delete. #help
If even root ain't able to delete, then it seems some pb with the drive or mount issue. You can once reboot your box and then try to remove files.
Also once check where these files are mounted and what are permissions on drive.
As the messages keep telling you over and over, the filesystem is mounted read-only. No changes are possible. What to do next depends on whether the filesystem was intentionally mounted read-only, or became read-only due to an error. If intentional (seems unlikely for a log directory), it's just a matter of running "mount -o remount,rw /path/to/mount/point" to make it read-write. If an error caused the filesystem to become read-only, then an fsck will be necessary to clean up the problem.
Because of the wide variety of ways filesystems could be laid out and mounted, it's hard to give precise instructions. The output from "mount" and "df /opt/IBM/WebSphere/AppServer/profiles/xyz/logs/server1/" would be helpful.
As the messages keep telling you over and over, the filesystem is mounted read-only. No changes are possible. What to do next depends on whether the filesystem was intentionally mounted read-only, or became read-only due to an error. If intentional (seems unlikely for a log directory), it's just a matter of running "mount -o remount,rw /path/to/mount/point" to make it read-write. If an error caused the filesystem to become read-only, then an fsck will be necessary to clean up the problem.
Because of the wide variety of ways filesystems could be laid out and mounted, it's hard to give precise instructions. The output from "mount" and "df /opt/IBM/WebSphere/AppServer/profiles/xyz/logs/server1/" would be helpful.
Thanks! I understand the issue atleast. I tried mounting, but failed. below is the output from df and mount.
Code:
df /opt/IBM/WebSphere/AppServer/profiles/xyz/logs/server1/
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VG01-LogVol04
19838052 14518428 4295624 78% /opt
Code:
mount -o remount,rw /opt/
mount: block device /dev/VG01/LogVol04 is write-protected, mounting read-only
Code:
mount -o remount,rw /opt/IBM/WebSphere/AppServer/profiles/xyz/logs/server1/
mount: can't find /opt/IBM/WebSphere/AppServer/profiles/xyz/logs/server1 in /etc/fstab or /etc/mtab
Can you please help with fsck in detail. I never used it. and my server is production server so scared to use it without following precautions.
mount -o remount,rw /opt/
mount: block device /dev/VG01/LogVol04 is write-protected, mounting read-only
The problem is not with the filesystem, but is due to an LVM logical volume that has been made write-protected. The question now is, "Why?" Again, since this volume contains a log directory, I doubt that it was done deliberately. Look for any LVM-related error messages near the top of /var/log/boot.log or perhaps in /var/log/messages* (which could be quite a way back if this server has not been rebooted in a while). Frankly, I don't know whether there are errors that would cause a logical volume to be made read-only as opposed to being simply deactivated, but it's something to look for.
You can change the volume to read/write by running "lvchange -prw VG01/LogVol04". You can then remount the filesystem read/write, but before doing that it would be a good idea to check it. You can safely run "fsck -n -f /dev/VG01/LogVol04" while the filesystem is still mounted read-only. The "-n" flag will prevent fsck from actually changing anything, but it will still report any problems it finds. A read-only filesystem should not have any problems noted.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.