解決手段としては一般ユーザーからsudoコマンドを使って作業を行うようにする方法がある。
一般的にはrootで作業を行う場合は
ホストは使用したいホストを書く。一般的にはALLと書く様です。
権限には「誰の権限でコマンドを実行したいか」を書くようです(例:(root))が、ここも一般的にはALLにすることが多い様です。コマンドにはsudoで扱えるコマンドを絶対パスで指定します。複数指定する場合は,(カンマ)で区切ります。一般的には、以下のような設定にすることが多い様です。
一般的にはrootで作業を行う場合は
$ su -とするが、sudoコマンドを使うようにすれば、
パスワード:
# vi abc.txt
$ sudo vi abc.txtというように、root権限で行いたい作業のコマンドの後ろにsudoをつけ、一般ユーザーのパスワードを使うことでrootユーザーと同じ作業を行うことが出来る。一般ユーザーにsudoコマンドを使う権限を与えるにはrootユーザーからvisudoコマンドを使って、sudoコマンドの設定ファイルである/etc/sudoersを編集する。
[sudo] password for user:
# visudoDebian Lennyの場合、標準でnanoエディタが起動する。
# /etc/sudoers「root ALL=(ALL) ALL」と言う風になっている文章の下に、権限を与えたいユーザーを加える。書式は以下の通り。
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL) ALL
# Uncomment to allow members of group sudo to not need a password
# (Note that later entries override this, so you might need to move
# it further down)
# %sudo ALL=NOPASSWD: ALL
ユーザ ホスト=(権限) コマンドユーザには、sudo権限を与えたいユーザー名を記述する。今回の例ではsaoriにする。
ホストは使用したいホストを書く。一般的にはALLと書く様です。
権限には「誰の権限でコマンドを実行したいか」を書くようです(例:(root))が、ここも一般的にはALLにすることが多い様です。コマンドにはsudoで扱えるコマンドを絶対パスで指定します。複数指定する場合は,(カンマ)で区切ります。一般的には、以下のような設定にすることが多い様です。
# /etc/sudoers上記は、単純にsaoriユーザーにsudoコマンドを使えば、全てのコマンドをスーパーユーザ権限で使えるように設定しています。
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL) ALL
saori ALL=(ALL) ALL
# Uncomment to allow members of group sudo to not need a password
# (Note that later entries override this, so you might need to move
# it further down)
# %sudo ALL=NOPASSWD: ALL



