Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
    
Partition identifier = the UUID or the device identifier, you can get this information for a particular partition by entering sudo blkid in your terminal. Mount point is the location where you'd like the partition to be mounted, usually /media or /mnt, you'll have to create a folder there and the location of that folder becomes the mount point. –  nitstorm Nov 6 '12 at 18:50
add comment

2 Answers

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.

share|improve this answer
    
Thanks! :) I tried to change permissions but it was not working so someone told me to remount the folder. Problem is solved now, I used "mount -o remount,rw /", which remounted the folder and I edited the file, without changing permissions. –  user1204089 Nov 6 '12 at 12:09
    
@user1204089 accept the answer so others doesn't have to try and solve it. Thanks! –  Alvar Nov 6 '12 at 15:34
add comment
up vote 1 down vote accepted

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.