LoginSignup
13
17

More than 5 years have passed since last update.

CentOSでsudoコマンドを使用できるようにする

Posted at

sudoコマンドは設定しないと使用することができません。
ubuntuとは異なりますね。
最近はubuntuしか使っていなかったのでここで躓いた…

試しにsudoを叩いてみると次のように表示されて機能しないです。

pakiln is not in the sudoers file. This incident will be reported.

sudoコマンドの使用を許可する

まずrootでログインします。
次にターミナルでvisudoを実行。

pakilnユーザーにsudoの許可を与えてみます。
どこでも良いので次の一行を追加します。

pakiln  ALL=(ALL)       ALL

今回は「root ALL=(ALL) ALL」の下に追加して保存。

## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL
pakiln  ALL=(ALL)       ALL

これでpakilnユーザーでsudoを使えるようになりました。

13
17
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
13
17