1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

'readonly' option is set (add ! to override)が出た時の対応

Last updated at Posted at 2024-07-04

はじめに

設定ファイルなどを編集して保存しようとした際に'readonly' option is set (add ! to override)というエラーが出た時の対処法。(権限不足)
以下コマンドを実行することでsudo権限を使って強制的に保存できる。

手順

Vimのコマンドモードで以下コマンドを実行

:w !sudo tee %

tee コマンドで現在開いているファイルを、強制的に上書きする。

w : ファイルの保存
!sudo tee : !sudo tee コマンド
% : 現在開いているファイル

:q!で終了

:q!

上記手順で編集内容が保存される。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?