From owner-freebsd-questions@FreeBSD.ORG Fri Sep 4 16:30:01 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 B8FDD1065676 for ; Fri, 4 Sep 2009 16:30:01 +0000 (UTC) (envelope-from randy.belk@gmail.com) Received: from mail-yw0-f180.google.com (mail-yw0-f180.google.com [209.85.211.180]) by mx1.freebsd.org (Postfix) with ESMTP id 67EAD8FC1D for ; Fri, 4 Sep 2009 16:30:01 +0000 (UTC) Received: by ywh10 with SMTP id 10so1847673ywh.7 for ; Fri, 04 Sep 2009 09:30:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=yfYWvNl2rr/p+jd9U7zUDH4I0VsoFyw+1BkUL6/gKO8=; b=tGONepaHguNs5NWcOcmjy4iHY/8fTVeJujIwrav7+mVgbQr+t+lWgFSK2gVzGhPJm/ UHdw7081SCf/UKji8oSPx2merMjGVwzXOPVHAXiRNvMfjykdEXWCia1sNXrlqocTIuS/ 3on4TdCzGxspOgIipvzl7OU0WA/mLgFzNlEvY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=d014Jh4IRqup/hO8rSS3zhxFG/439amruWCoGx3AgDCUO/tdRJ2N7QZb9S05NxHtS7 yu7UXce1+o/mTFVM1a0l5jOCRMMx1tzdRlzB1Fb+88fFu+WDjYo5qoIRibNbB1vinBWQ CM2fJslrEz9wjW0fQvbilDe7V9RUK8/jSkzEE= MIME-Version: 1.0 Received: by 10.150.44.12 with SMTP id r12mr18894143ybr.2.1252079974811; Fri, 04 Sep 2009 08:59:34 -0700 (PDT) In-Reply-To: <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> <20090904155011.GA13136@marvin.optimis.net> From: Randy Belk Date: Fri, 4 Sep 2009 10:59:12 -0500 Message-ID: <946140ad0909040859k519ddfcar5230e745966daec1@mail.gmail.com> To: George Davidovich , freebsd-questions@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: 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 16:30:01 -0000 On Fri, Sep 4, 2009 at 10:50 AM, George Davidovich wro= te: > 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=3D'/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". =A0It's a feature. =A0;-) =A0Re-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'. =A0That will your > current environment unmodified and all your existing aliases will remain > available for use. > > -- > George > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.o= rg" > There is a way for what you are wanting to do. Make an alias for sudo that looks like this "sudo=3D'sudo -E (Your default = shell)" Since I use zsh my alias looks like this sudo=3D'sudo -E zsh' It perserves all of your aliases, paths, and everything else . --=20 - Amiga, The Computer for the creative Mind! - UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity. - People who hate Microsoft Windows use Linux but people who love UNIX use = BSD.