Changing fqdn in centos without prompting password from sudo user

170 Views Asked by At

For root user we can change FQDN as host-name like this:

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

1

There are 1 best solutions below

5
On

passwordless sudo.

setup sudo to allow hostname to be usable without password to those users who need it.

add a ine like this to /etc/sudoers

@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