终端和SSH会话之间的区别

时间:2018-05-08 15:47:01

标签: linux ssh ubuntu-16.04

当我尝试在ubuntu 16.04中关闭时间同步时,即使我没有以root身份运行它也是成功的,timedatectl的手册页表明它应该提示我进行授权。命令:

timedatectl set-ntp off

但是,如果我使用同一个用户ssh到框中,我会收到提示:

ssh localhost
timedatectl set-ntp off
==== AUTHENTICATING FOR org.freedesktop.timedate1.set-ntp ===
Authentication is required to control whether network time synchronization shall be enabled.

有没有人知道为什么我在本机shell中运行时不会收到提示?如何在ssh时将系统配置为NOT提示?感谢。

注意:我怀疑这与凭证密钥环有关。我还在调查,如果我弄明白,我会更新/关闭这个问题。

1 个答案:

答案 0 :(得分:-1)

虽然我无法弄清楚幕后发生了什么,但我能够通过添加一个sudo规则来解决这个问题:

$USER ALL=(root) NOPASSWD :/usr/bin/timedatectl *

这允许我在不提示输入密码的情况下使用'sudo timedatectl set-ntp off'。