0
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?

More than 3 years have passed since last update.

visudoがない

0
Last updated at Posted at 2023-04-05

背景

debian11をインストールしたとき、sudoがインストールされていなかった。

試したこと

sudoをインストールした後に、sudo apt install XXXを実行
👇
sudo権限がないと怒られた。
👇
visudoコマンドをroot権限からvisudoを実行
👇
visudoがないと怒られた。
なぜvisudoのコマンドがありませんとなっていたのか?

答え

suを実行していた

解決方法

su -を実行する

解説

ハイフンがないと環境変数がログインユーザーのままになってしまい、visudoが実行できない

おまけ

Linuxユーザーにsudo権限を付ける方法

  1. visudosudoersファイルを開く
  2. sudoers内のsudoグループに関する記述が%sudo ALL=(ALL) ALLになっていることを確認
    1. %はグループを表す
  3. usermod --append -G sudo <username> を実行
  4. idコマンドでsudo管理グループに追加されているか確認
  5. rebootまたはshutdown -r nowで再起動してsudoersファイルの変更を反映させる

※他のテキストエディタでsudoersファイルを開くと、read onlyなため編集できない!

0
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
0
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?