Operating System - HP-UX
1828233 Members
2619 Online
109975 Solutions
New Discussion

apply check on hostname command

 
kashifr
Advisor

apply check on hostname command

How to prevent administrator accidentally type “hostname –a”, which will change the hostname to –a. Normally this is happened when user confuse “uname” command with “hostname”. Any permanent solution to avoid this?

4 REPLIES 4
spex
Honored Contributor

Re: apply check on hostname command

Hi,

# chmod -x /usr/bin/hostname
or rename the binary and write a wrapper script.

PCS
Coolmar
Esteemed Contributor

Re: apply check on hostname command

Rename the binary.

That being said, generally administrators with root privileges would know the difference between "hostname" and "uname" and not make the mistake. Also, if the mistake is made, it can very quickly be changed back.
spex
Honored Contributor

Re: apply check on hostname command

I completely agree with Coolmar here. If an administrator has to be restricted from using a command, he shouldn't be an administrator in the first place.
kashifr
Advisor

Re: apply check on hostname command

By changing the bin file, it works fine.