我已经接管了一个使用 postgres 的系统。登录时,如果我使用...
sudo -u postgres psql postgres
Run Code Online (Sandbox Code Playgroud)
...它不要求输入密码。但是,如果我这样做...
psql -U postgres -h localhost postgres
Run Code Online (Sandbox Code Playgroud)
...它要求输入密码。
为什么?这种差异是如何配置的?是否可以为不同的用户配置以这种方式登录?
(注意:用户postgres不在sudoers文件中,也不在 sudo 组中。