From owner-freebsd-questions@FreeBSD.ORG Sun Jan 20 07:10:30 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D40AB16A417 for ; Sun, 20 Jan 2008 07:10:30 +0000 (UTC) (envelope-from wahjava@gmail.com) Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.182]) by mx1.freebsd.org (Postfix) with ESMTP id 835C313C442 for ; Sun, 20 Jan 2008 07:10:30 +0000 (UTC) (envelope-from wahjava@gmail.com) Received: by wa-out-1112.google.com with SMTP id k17so2880986waf.3 for ; Sat, 19 Jan 2008 23:10:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:to:cc:subject:x-face:references:x-pgp-fp:x-pgp:x-mailer:x-attribution:pgp:organization:from:date:in-reply-to:message-id:user-agent:face:mime-version:content-type:sender; bh=qiE35zlmhrHkWFrFZb92ImjTRl2TMiaIA6+Yb8sWscQ=; b=W7vGB3eXkP7Uh557jr2vlEiHSrVb24P/lsV8x5m017h5DEBWhU53l01VAXVGEdMDc13tU4NJIhXjn6CFOWFUypBeCNNgk5Ch1NC0PTsI5vNg6gZhx7H4Cin8eDdQxk4c8Nh2EtBsFKp5X7PnhuxF8VBl8w2+G2qaf5he7bkEy9Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=to:cc:subject:x-face:references:x-pgp-fp:x-pgp:x-mailer:x-attribution:pgp:organization:from:date:in-reply-to:message-id:user-agent:face:mime-version:content-type:sender; b=QhcpAWnnwikCGnuzKw8OWBVCyQfdkHfywhaRMnnYPnebU/aC8kLUoEbdqSwErTqMMUdBGKGtitcwchD5P95mVken533372xhjG7jv3U6uLXHDjhV4Kb3LtR4tdJC50AZxe7dj1Zc7GLDQbRi0FeA5zYQmrFTEyNcauOBnVCyIZM= Received: by 10.114.194.1 with SMTP id r1mr3473158waf.40.1200813029487; Sat, 19 Jan 2008 23:10:29 -0800 (PST) Received: from chateau.d.lf ( [122.162.250.141]) by mx.google.com with ESMTPS id k24sm12033338waf.22.2008.01.19.23.10.27 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 19 Jan 2008 23:10:29 -0800 (PST) To: Chris Whitehouse X-Face: "\:nMpJ)EA!j>2nEu-[(+&o:N+CtL^AS\, Jv*LO5qBr#W2.\=d <877ii5fsh0.fsf@chateau.d.lf> <47928A73.2040904@onetel.com> X-PGP-FP: 1E00 4679 77E4 F8EE 2E4B 56F2 1F2F 8410 762E 5E74 X-PGP: 762E5E74 X-Mailer: Gnus/5.11 (Oort 5.11) Emacs/22.1.50.1 (x86_64-pc-linux-gnu) X-Attribution: =?utf-8?B?4KSG4KS24KWA4KS3?= PGP: 762E5E74 Organization: /\/0/\/3 From: wahjava.ml@gmail.com (Ashish Shukla =?utf-8?B?4KSG4KS24KWA4KS3IA==?= =?utf-8?B?4KS24KWB4KSV4KWN4KSy?=) Date: Sun, 20 Jan 2008 12:40:37 +0530 In-Reply-To: <47928A73.2040904@onetel.com> (Chris Whitehouse's message of "Sat\, 19 Jan 2008 23\:40\:35 +0000") Message-ID: <87tzl97z0y.fsf@chateau.d.lf> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEVfX1/8/PwTExMDAwO0 tLSampr////f398oKCi/v78MDAwICAihq32EAAACU0lEQVQ4jW3UvWvbQBQA8LOJsJIsOajtZAtH Aqq8FLQUvNjhCex2UYpE7XYytPJalxJnFMImqrOkIJfcZtwGgrqEhELQ/XN9p+jLbc+Drfvx7r17 9jNxszXCV2mR9P3ACoKAOM5bugn1hRBRFAnxeErLMN4RIpbwYKwmZfgkMGDNol8PhlFrFDDalQcx BMMwXpwV8KElYqYzpmOA0a4UsC/EmrEU4ptGDq9kghTabP09g9EuFiSpJQOYXslgrEd6Aj8Q7pl+ kcFH3NRlUTIFfvyZwV4sEzwV20a4y2A/BWEYLxdYwk0Gn+Mohfa2X4bXsn8StC0uYdVI4T02cK0F is15ArcZYKeER5Q+f4JofZZHiPshJPt8BwtPrp4kF+KOp+sdpjvOjqpf3n+1bD6dTjk3ySKuZVU1 ezcdpm3h/pL4h9eP3Rw6R5bqa9t86a/1W3OVd7dpzgBMx8YAxVFgvgmqDTwEdQignOVgI1ggoQMA x40CFHzmCHgXcEoAig39MOSATTGt5znQL4qDIRIgNK2LAqYWAl47lBGDSgHNjoOt6vdDkNAtQc9E wN0EJgXQN7aMSABIGU7mMiI5CtQJzX9w9PwQYOApVqBwCMqwp9lmkKzh0qM5uPTAn/Vw0ogazK9m JRjR6pHqEVyqd1XbgPPfKkgAddClxRi49NmKcNMh+JV4T7mzqW1e2jwk3pAPjugGuCfHPLRIP/Qr tLEB9daW7HrvcLIx55i/9zjkfMlO//pnwLHyPcupzrL9AtxrFgTaN/dfGFcjreb+B9wmnzaKpz8p dKsBFjzeRQAAAABJRU5ErkJggg== MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Sender: =?UTF-8?B?4KSG4KS24KWA4KS3IOCktuClgeCkleCljeCksg==?= Cc: freebsd-questions@freebsd.org Subject: Re: localhost in sudoers X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jan 2008 07:10:30 -0000 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable >>>>> On Sat, 19 Jan 2008 23:40:35 +0000, Chris Whitehouse said: Chris> I think my question really is why doesn't sudoers recognise loca= lhost Chris> or 127.0.0.1? Quoting from sudo.c of sudo-1.6.8p12 in "init_vars(int)" routine: =2D---8<----8<---- /* * We avoid gethostbyname() if possible since we don't want * sudo to block if DNS or NIS is hosed. * "host" is the (possibly fully-qualified) hostname and * "shost" is the unqualified form of the hostname. */ sudo_user.host_fqdn_queried =3D FALSE; nohostname =3D gethostname(thost, sizeof(thost)); if (nohostname) user_host =3D user_shost =3D "localhost"; else { user_host =3D estrdup(thost); if ((p =3D strchr(user_host, '.'))) { *p =3D '\0'; user_shost =3D estrdup(user_host); *p =3D '.'; } else { user_shost =3D user_host; } } =2D--->8---->8---- As you can see, it uses gethostname() to return the hostname. So, your host won't be 'localhost' unless its not able to retrieve hostname or your hostname is set to 'localhost'. Why they did this probably because any entry for 'localhost' is valid for execution on all machines, ;) . HTH =2D-=20 Ashish Shukla =E0=A4=86=E0=A4=B6=E0=A5=80=E0=A4=B7 =E0=A4=B6=E0=A5=81=E0=A4= =95=E0=A5=8D=E0=A4=B2 http://wahjava.wordpress.com/ =C2=B7-- =C2=B7- =C2=B7=C2=B7=C2=B7=C2=B7 =C2=B7--- =C2=B7- =C2=B7=C2=B7=C2= =B7- =C2=B7- =C2=B7--=C2=B7-=C2=B7 --=C2=B7 -- =C2=B7- =C2=B7=C2=B7 =C2=B7-= =C2=B7=C2=B7 =C2=B7-=C2=B7-=C2=B7- -=C2=B7-=C2=B7 --- -- --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFHkvPwHy+EEHYuXnQRArUtAJ0df4aWOz61pDFGfUd5LcMvEkLE5ACfU/Nb yV41/9pd5LrIbbPSsW+YWBQ= =Uf+l -----END PGP SIGNATURE----- --=-=-=--