From owner-freebsd-questions@FreeBSD.ORG Fri Sep 4 01:58:30 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 1EAD1106566C for ; Fri, 4 Sep 2009 01:58:30 +0000 (UTC) (envelope-from mel.flynn+fbsd.questions@mailing.thruhere.net) Received: from mailhub.rachie.is-a-geek.net (rachie.is-a-geek.net [66.230.99.27]) by mx1.freebsd.org (Postfix) with ESMTP id D73EC8FC14 for ; Fri, 4 Sep 2009 01:58:28 +0000 (UTC) Received: from smoochies.rachie.is-a-geek.net (mailhub.lan.rachie.is-a-geek.net [192.168.2.11]) by mailhub.rachie.is-a-geek.net (Postfix) with ESMTP id 9690B7E853; Thu, 3 Sep 2009 17:58:39 -0800 (AKDT) From: Mel Flynn To: freebsd-questions@freebsd.org Date: Fri, 4 Sep 2009 03:58:24 +0200 User-Agent: KMail/1.11.4 (FreeBSD/8.0-BETA3; KDE/4.2.4; i386; ; ) References: <20090902072659.7829da56@scorpio.seibercom.net> <200909040134.05992.mel.flynn+fbsd.questions@mailing.thruhere.net> <20090903201036.36486533@scorpio.seibercom.net> In-Reply-To: <20090903201036.36486533@scorpio.seibercom.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200909040358.25774.mel.flynn+fbsd.questions@mailing.thruhere.net> 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 01:58:30 -0000 On Friday 04 September 2009 02:10:36 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. > > 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 doesn't. alias has the limitation. As far as alias is concerned, a command is the first thing on the command line, and for good reason, as you don't want it to look further along the command line and attempt to expand everything. So the shell only changes the command that is really run, when the first word matches an alias. Sudo or any app for that matter, never knew it was run through an alias. However.....reading through the bash manpage: If the last character of the alias value is a blank, then the next command word following the alias is also checked for alias expansion. So.....: $ alias sudo='/usr/local/bin/sudo ' $ alias pico='vim --version' $ sudo pico VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Jul 21 2009 13:22:46) Included patches: 1-6, 8-35, 37-48, 50-70, 73, 75-87, 90-92, 94-100, 102-137, 139-149, 151-171, 173-190, 192-193, 195-203, 206-209 However....be aware of the consequences. If someone compromises your account, then setting: alias ls='/tmp/mkroot' and you running: sudo ls He just got root. -- Mel