LoginSignup
8
11

More than 5 years have passed since last update.

【Debian 8 Jessie】sudoコマンドをインストールする

Posted at

この記事は、下記の記事を構成している記事のひとつです。
さくらのVPS と Debian 8 Jessie で独自ドメインのWebサイトを立ち上げる手順

・さくらのVPS(プラン512)
・Debian 8 Jessie(さくらのVPS カスタムインストール)
の環境を前提にしています。

sudoコマンドをインストールする

rootユーザになる。

[hoge]$
su -

sudoコマンドをインストールする。

[root]#
aptitude -y install sudo

権限の設定を行う

/etc/sudoersファイルを編集して、権限の設定を行います。
viコマンド等で編集してもいいのですが、visudoコマンドを使うと、
ファイル保存時に文法にミスがないかチェックしてくれるので、
visudoコマンドを使って編集します。

[root]#
visudo
/etc/sudoers
# hogeはroot権限を全て利用できる
hoge  ALL=(ALL:ALL) ALL

動作確認を行う

rootユーザを抜ける。

[root]#
exit

sudoなしで、OS再起動コマンドを入力し、エラーメッセージが表示されることを確認する。

[hoge]$
shutdown -r now
-bash: shutdown: command not found

頭にsudoを付けて、OS再起動コマンドを入力し、OSが再起動されればOK。

[hoge]$
sudo shutdown -r now
8
11
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
8
11