From owner-freebsd-questions@FreeBSD.ORG Fri Dec 1 15:29:06 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2924816A500 for ; Fri, 1 Dec 2006 15:29:06 +0000 (UTC) (envelope-from xfb52@dial.pipex.com) Received: from smtp-out3.blueyonder.co.uk (smtp-out3.blueyonder.co.uk [195.188.213.6]) by mx1.FreeBSD.org (Postfix) with ESMTP id 03AAF43CD4 for ; Fri, 1 Dec 2006 15:28:25 +0000 (GMT) (envelope-from xfb52@dial.pipex.com) Received: from [172.23.170.143] (helo=anti-virus02-10) by smtp-out3.blueyonder.co.uk with smtp (Exim 4.52) id 1GqAJa-0000A8-TM; Fri, 01 Dec 2006 15:28:38 +0000 Received: from [82.46.239.57] (helo=[192.168.0.2]) by asmtp-out4.blueyonder.co.uk with esmtp (Exim 4.52) id 1GqAJX-0007rd-AQ; Fri, 01 Dec 2006 15:28:35 +0000 Message-ID: <45704A22.9060100@dial.pipex.com> Date: Fri, 01 Dec 2006 15:28:34 +0000 From: Alex Zbyslaw User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-GB; rv:1.7.13) Gecko/20061106 X-Accept-Language: en MIME-Version: 1.0 To: Ray Still References: <004601c71559$f2d645f0$6700a8c0@New> In-Reply-To: <004601c71559$f2d645f0$6700a8c0@New> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: Fw: Re: problem with script execution 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: Fri, 01 Dec 2006 15:29:06 -0000 Ray Still wrote: >>> Just out of curiosity: What is the "echo * |" supposed to do? From my >>> point of view the shell will expand "*" to the list of files and >>> directories in PWD, so "echo *" acts like a simple ls in this context. >>> This list is piped to sudo. But what does sudo do with these? >> >> >> sorry, I didn't want to show my passwords, so I replaced it with an >> astrix. the password of course is being read from the pipe by sudo >> because of the -S option. > Probably nothing to do with your original problem, but you do know that you can allow sudo to execute certain commands without a password? Passwords in shell scripts isn't exactly ideal... E.g. my sudoers has: Cmnd_Alias HEALTHD = /usr/local/sbin/healthd [...] %wheel ALL=(root) NOPASSWD: SMART_STATUS, HEALTHD, MBMON So anyone in group wheel (me :-)) can excecute any of the named commands without any password. You can also force the flags that will be passed - the sudoers man page has more details. --Alex