LoginSignup
59
63

More than 5 years have passed since last update.

CentOSの一般ユーザーにパスワードなしでsudoコマンドを使えるようにしました

Last updated at Posted at 2015-03-03

一般ユーザーにパスワードなしでsudoコマンドを付与しました。環境はCentOSです。

visudoコマンドを実行する

visudoコマンドを使うとsudo権限を付与できます。

visudoを実行
sudo visudo

viが立ち上がります。
pugiemonnという一般ユーザーにsudo権限を付与します。

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

rootユーザーに権限が付与されているのがわかります。
pugiemonnというユーザーを追加しました。

これでviエディタを閉じるとpugiemonnというユーザーでsudoコマンドが使えるようになります。

しかし、これだけではsudoコマンドを実行する度にパスワードを要求されます。

もう一度visudoしてエディタを開きます。

pugiemonn
## Same thing without a password
# %wheel        ALL=(ALL)       NOPASSWD: ALL
%pugiemonn      ALL=(ALL)       NOPASSWD: ALL

%wheelグループの指定がパスワード不要の書き方がコメントにされていたので、pugiemonnグループにNOPASSWDを指定しました。

今度はpugiemonnユーザーはパスワードなしでsudoコマンドが使えるようになりました。

59
63
2

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
59
63