使用 ssh 登录时无法使用 sudo

使用 ssh 登录时无法使用 sudo

我在本地服务器上设置了一台 ubuntu 机器。我有一个具有 sudo 权限的用户(与登录密码相同)。

我通过将我的 rsa 公钥放在 ubuntu 机器上,实现了无密码 ssh。所以我可以从我的 mac ssh 进入。但是当我通过 ssh 登录并尝试 sudo 时,它告诉我密码无效。

怎么回事?这是我的 /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"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    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

相关内容