'alias' + sudo

Dan Nelson dnelson at allantgroup.com
Wed Sep 2 20:06:50 UTC 2009

In the last episode (Sep 02), Jerry said:
> On Wed, 2 Sep 2009 13:06:28 -0600
> Tim Judd <tajudd at 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":

  #! /bin/sh
  pico -m "$@"

	Dan Nelson
	dnelson at allantgroup.com

More information about the freebsd-questions mailing list