Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Sep 2009 15:06:48 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: 'alias' + sudo
Message-ID:  <20090902200648.GF2855@dan.emsphone.com>
In-Reply-To: <20090902152821.6baf568c@scorpio.seibercom.net>
References:  <20090902072659.7829da56@scorpio.seibercom.net> <ade45ae90909021206u43135147u1f9431c10a043dda@mail.gmail.com> <20090902152821.6baf568c@scorpio.seibercom.net>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Sep 02), Jerry said:
> On Wed, 2 Sep 2009 13:06:28 -0600
> Tim Judd <tajudd@gmail.com> wrote:
> > Because sudo calls the binary, via SUID on sudo.  It doesn't pay
> > attention to user profiles or rc files (like .bashrc).
> > 
> > I don't use sudo, so I can't recommend past that.
> 
> In other words, sudo is not compatible with the bash 'alias' feature.  Is
> that correct?  I Googled and found several references to sudo and alias;
> however, no consensus on how to circumvent the problem.

sudo does not run root's shell at all; it directly runs whatever is given it
on the commandline.  Workarounds include creating an alias that includes
sudo in it (alias rootpicom='sudo pico -m'), or creating a shell script that
runs what your alias would have, so you can run "sudo picom":

/usr/local/bin/picom
  #! /bin/sh
  pico -m "$@"

-- 
	Dan Nelson
	dnelson@allantgroup.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090902200648.GF2855>