与 SUDO 密码不同的 SSH/登录密码

Ric*_*ard 9 linux debian sudo password-management login

我想使用不同的密码将我的用户提升到 sudo 状态,而不是我用来登录(通过 GUI、shell 或 SSH)到我的帐户的密码。这可能吗?

编辑: 由于设置 root 密码将允许以 root 身份登录,这不是一个好方法。我更喜欢用户特定的 sudo 密码,而不是系统范围的 root 密码。

Cha*_*ens 2

来自 man sudoers:

\n\n
rootpw          If set, sudo will prompt for the root password instead of the\n                password of the invoking user.  This flag is off by default.\n\nrunaspw         If set, sudo will prompt for the password of the user defined\n                by the runas_default option (defaults to root) instead of the\n                password of the invoking user.  This flag is off by default.\n
Run Code Online (Sandbox Code Playgroud)\n\n

或者您可以完全禁止通过 ssh 基于密码的登录。远程登录需要密码加密密钥。然后你就可以随意使用sudo的密码了。相关选项是

\n\n

来自 man sshd_config

\n\n
 PasswordAuthentication\n         Specifies whether password authentication is allowed.  The default\n         is \xe2\x80\x9cyes\xe2\x80\x9d.\n
Run Code Online (Sandbox Code Playgroud)\n