【Linux】sudoユーザーの追加
sudo権限はsuperと一般ユーザーの間で、操作ミスによるトラブルではなく、必要に応じて管理者権限を発揮し、システム管理者に適しています.一般ユーザーにsudo権限を追加する手順:1.suはスーパーユーザーモードに入ります.2.ファイルの書き込み権限を追加します(デフォルトでは、このファイルを書かないユーザーはいません).
root@master:~# chmod u+w /etc/sudoers
3./etc/sudoersファイルを編集します.root@master:~# vim /etc/sudoers
4.編集モードに入り、この行を見つけます.「root ALL=(ALL)ALL」から「xxx ALL=(ALL)ALL」(ここのxxxはあなたのユーザー名)を追加し、保存して終了します.root@master:~# cat /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
dream361 ALL=(ALL:ALL) ALL #
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d
5.ファイルの書き込み権限を取り消します.root@master:~# chmod u-w /etc/sudoers
6.exitを終了して一般ユーザーに戻ればいいです.