localhost in sudoers

Chris Whitehouse cwhiteh at onetel.com
Sat Jan 19 10:58:51 PST 2008


Hi,

If I put my computers ip address in sudoers a command runs successfully. 
  If I put localhost I am prompted for a password.

Check I can't run it normally:
%/root/testsudo
/root/testsudo: Permission denied.

Entry in sudoers:
chrisw  192.168.1.71=NOPASSWD:/root/testsudo

%sudo /root/testsudo
hello

Entry in sudoers:
chrisw  localhost=NOPASSWD:/root/testsudo

%sudo /root/testsudo
Password:
chrisw is not allowed to run sudo on eco.  This incident will be reported.
%ping localhost
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.034 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.021 ms
^C

/var/log/messages says 'user NOT authorized on host'

The problem is this machine gets its ip address by dhcp so I shouldn't 
enter an ip in sudoers. Is there a neat way round this?

Thanks

Chris


More information about the freebsd-questions mailing list