From owner-freebsd-questions@FreeBSD.ORG Fri Sep 4 15:50:12 2009 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 F2793106568D for ; Fri, 4 Sep 2009 15:50:12 +0000 (UTC) (envelope-from freebsd@optimis.net) Received: from mail.optimis.net (mail.optimis.net [69.104.191.124]) by mx1.freebsd.org (Postfix) with ESMTP id C48B68FC13 for ; Fri, 4 Sep 2009 15:50:12 +0000 (UTC) Received: from marvin.optimis.net (marvin.optimis.net [192.168.1.3]) by mail.optimis.net (8.14.3/8.14.2) with ESMTP id n84FoBMv047930 for ; Fri, 4 Sep 2009 08:50:11 -0700 (PDT) (envelope-from freebsd@optimis.net) Received: from marvin.optimis.net (localhost [127.0.0.1]) by marvin.optimis.net (8.14.3/8.14.3) with ESMTP id n84FoB38013707 for ; Fri, 4 Sep 2009 08:50:11 -0700 (PDT) (envelope-from freebsd@optimis.net) Received: (from george@localhost) by marvin.optimis.net (8.14.3/8.14.3/Submit) id n84FoBTD013706 for freebsd-questions@freebsd.org; Fri, 4 Sep 2009 08:50:11 -0700 (PDT) (envelope-from freebsd@optimis.net) Date: Fri, 4 Sep 2009 08:50:11 -0700 From: George Davidovich To: freebsd-questions@freebsd.org Message-ID: <20090904155011.GA13136@marvin.optimis.net> References: <20090902072659.7829da56@scorpio.seibercom.net> <200909040134.05992.mel.flynn+fbsd.questions@mailing.thruhere.net> <20090903201036.36486533@scorpio.seibercom.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090903201036.36486533@scorpio.seibercom.net> User-Agent: Mutt/1.5.19 (2009-01-05) Subject: Re: 'alias' + sudo 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, 04 Sep 2009 15:50:13 -0000 On Thu, Sep 03, 2009 at 08:10:36PM -0400, Jerry wrote: > On Fri, 4 Sep 2009 01:34:05 +0200 Mel Flynn wrote: > > > alias spico='/usr/local/bin/sudo pico -m' and be done with it. Instead of an extra alias, why not export $VISUAL or $EDITOR, and rely on sudoedit(8)? > That is what I am currently doing; however,there are other commands > that I want to use that are not available when used via sudo without > modifying the alias. I did not realize that sudo had such a > limitation. It's not a "limitation". It's a feature. ;-) Re-read the sudo manpage. I'd be surprised if most of your aliases would ever require root privileges, and are anything but one-off shortcuts for your personal use. For those that do, I'd suggest replacing them with a function (or script) that tests for root privileges (using something like id(1)), and invokes sudo when appropriate. Otherwise, you may want to consider using 'su -m'. That will your current environment unmodified and all your existing aliases will remain available for use. -- George