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.

karel
  • 114,770
wiry
  • 541

5 Answers5

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

Zanna
  • 70,465
waltinator
  • 36,399
  • Thank you , i use sudo before vim then i could edit source.list – milad salimi Mar 16 '19 at 08: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-xBut 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 getE505: "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 '20 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>

14

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

Next, use sudo vim filename and later: :wq

Eliah Kagan
  • 117,780
NadZ
  • 241
  • 2
  • 3
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!!!

shgnInc
  • 4,003
  • This is particularly helpful if you have made a ton of changes and do not want to close the file and reopen using sudo. – Vishwas M.R Nov 16 '22 at 02: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...

Zanna
  • 70,465