How to remount a read-only folder as readWrite?

Background:

I need to edit a file which is read only, and its parent folder is also 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"

and for folder

drwxr-xr-x 3 admin root

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

Someone suggested to remount the folder which contains this file.

Problem:

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

I looked at question How do I remount a filesystem as read/write?, but I did not understand the answer...

It said correct syntax is

sudo mount -o remount,rw /partition/identifier /mount/point

What should I give as /partition/identifier and /mount/point? I.e. what is this /partition/identifier and /mount/point?


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


You don't need to remount anything. You must to change permissions. You can do it with this command:

sudo chmod 777 file.sh

This give all permisions to file, if you wish leave as read only for group and for rest of users you can do:

sudo chmod 644 file.sh

or

sudo chmod 755 file.sh

The first is for read-only, end the second for read and execute.