54

I'm trying to configure the extension mcrypt in my Ubuntu Server VirtualBox for work in my phpMyAdmin page.

I ran vi /etc/php5/mods-available/mcrypt.ini and then I changed extension=mcrypt.so to extension=/usr/lib/php5/20121212/mcrypt.­so and when I tried to save changes it said this:

E45 readonly option is set (add ! to override)

I think that maybe I made a mistake deleting something before extension=mcrypt.os and I don't know what to do.

4

5 Answers 5

37

Probably the user you ran vi /etc/php5/mods-available/mcrypt.ini as did not have write access to the file. vi notices this on file open, and, when you try to save the file, gives you the E45error, and reminds you that you could attempt to override the read-onlyness of the file by appending '!' to the command.

For example, if you edited a file owned by your user, protected 444 (r--r--r--), you would get this message when you did the :wq, but could try to force the write with :wq!. In your case, I suggest doing ls -l /etc/php5/mods-available/mcrypt.ini. To actually edit the file, you could use sudo to temporarily use the power of root, and do sudo vi /etc/php5/mods-available/mcrypt.ini

2
  • Thank you , i use sudo before vim then i could edit source.list Mar 16, 2019 at 8:27
  • Doesn't seem like a permission problem. In my case: getfacl file.sh; # file: file.sh # owner: me # group: thegroup user::rwx group::r-x other::r-x But I still get the error! As soon as I press "i", this appears -- INSERT (paste) -- W10: Warning: Changing a readonly file, after making some changes, when I try to save I get E505: "file.sh" is read-only (add ! to override), Same permission also exist for the parent directory: # owner: me # group: thegroup user::rwx group::r-x other::r-x , this is really weird! And this is happening to any file that I create!
    – quanta
    Jun 23, 2020 at 15:59
17

You can press Esc , and then U , and then type :q .

You can try opening the file with sudo privilege: sudo vi <file_name>

1
  • 1
    Adding sudo works
    – Morris
    Nov 12, 2019 at 11:12
14

First come out of the vim editor using: :qa!

Next, use sudo vim filename and later: :wq

1
10

Try the below command

:w !sudo tee %

Explanation, What's happening?

  • :w – write
  • !sudo – call shell sudo command
  • tee – the output of write (:w) command is redirected using tee
  • % – current file name

So, in next Press L to reload.

just this!!!

1
  • This is particularly helpful if you have made a ton of changes and do not want to close the file and reopen using sudo. Nov 16, 2022 at 2:39
1

This happens when the user is trying to write on a file without the right permissions. Login as root using sudo su and now you can do the edit...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .