Debian 10 加入 sudo

本文阅读 1 分钟
首页 Debian,Linux 正文

很多時候我們不希望直接使用 root 來進行登入
但是又希望一般使用者可以執行 root 權限,此時我們需要通過 sudo 來幫忙,在 Ubuntu 裡面這些功能是已經內鍵了,但 Debian 則需要我們手動來安裝。

首先先通過 apt 來安裝 sudo

apt install sudo

接著編輯 /etc/sudoers 這個檔案

vi /etc/sudoers

在 root ALL=(ALL:ALL) ALL 底下加入使用者的名稱

#
# 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"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL
user    ALL=(ALL:ALL) ALL #將 user 修改為您的使用者名稱

# 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
本文来自投稿,不代表本站立场,如若转载,请注明出处:
Debian 10 把 rc.local 加回來
« 上一篇 04-10
什麼是原生 IP?
下一篇 » 05-27