简体   繁体   English

在centos中更改fqdn而不提示sudo用户的密码

[英]Changing fqdn in centos without prompting password from sudo user

For root user we can change FQDN as host-name like this: 对于root用户,我们可以将FQDN更改为主机名,如下所示:

hostname 'test.com'

But now, I need to change host-name from other users also we can use like this; 但是现在,我需要更改其他用户的主机名,我们也可以这样使用;

sudo  hostname 'test.com' 

But, it prompting for password, other users also have password, how to give that password without manual interruption. 但是,它提示输入密码,其他用户也有密码,如何在不手动中断的情况下提供该密码。

Thanks, Indu 谢谢印度

passwordless sudo. 无密码的sudo。

setup sudo to allow hostname to be usable without password to those users who need it. 设置sudo以允许主机名无需密码即可用于那些需要它的用户。

add a ine like this to /etc/sudoers 在/ etc / sudoers中添加一个这样的ine

@hostchangers ALL=NOPASSWD: /bin/hostname

and add those who need that priveledge to group hostchangers (you'll have to dcreate that group) then they'll have to log in again 并将需要特权的人添加到组主机更改程序中(您必须创建该组),然后他们必须再次登录

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM