Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't edit a read-only file for which I have the write access and also can not change its permission; how to remount its parent folder? [closed]

I need to edit a file which is read only. This file is located at a remote appliance. Through ssh I logged in to this as admin and I have the root access.

Command "ls -l" show the permissions of file as

"-rwxr-xr-x 1 admin root   952 Oct 30 02:01 file.sh"

I am not as such familiar with Linux but I searched and found that this above line means that the admin is the owner and he/she has the read and write permission.

But the file is appearing to be read only, I am unable to edit it. So I tried to change the permission using command chomd

[admin@appliance targetfolder]# chmod 666 file.sh
chmod: changing permissions of `file.sh': Read-only file system

But still it is just read-only.

Someone suggested to remount the folder which contains this file.

How will I remount it, I used

" mount -o remount,rw /folde1/folder2/targetFolder" 

but It gave

"mount: can't find /folde1/folder2/targetFolder in /etc/fstab or /etc/mtab".
like image 885
blackfyre Avatar asked Jan 20 '26 20:01

blackfyre


1 Answers

Problem is solved, I remounted folder by using "mount -o remount,rw /" and then edited the file, without changing any permissions, it worked.

like image 144
blackfyre Avatar answered Jan 23 '26 02:01

blackfyre



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!