su -
[管理者のパスワードで管理者へスイッチ]
sudo
[一般ユーザーのパスワードで管理者権限の一部を実行]
id
[@ ~]$ id uid=1000(Username) gid=1000(Username) groups=1000(Username)
(閲覧のみ)vim /etc/sudoers
編集は、visudoで行うことが推奨されている
vim /etc/sudoers
visudo
## Allow root to run any commands anywhere root ALL=(ALL) ALL ## Allows members of the 'sys' group to run networking, software, ## service management apps and more. # %sys ALL = NETWORKING, SOFTWARE, SERVICES, STORAGE, DELEGATING, PROCESSES, LOCATE, DRIVERS ## Allows people in group wheel to run all commands %wheel ALL=(ALL) ALL ## Same thing without a password # %wheel ALL=(ALL) NOPASSWD: ALL # [2020.05.20] Added # https://qiita.com/Esfahan/items/a159753d156d23baf180 (特定のユーザー名) ALL=(ALL) ALL
- 一旦、一般ユーザーをログアウトし、ログインし直すとsudoが使える。